# JQGeTuiService **Repository Path**: zjq_net/JQGeTuiService ## Basic Information - **Project Name**: JQGeTuiService - **Description**: 基于JQSOAppDelegate和GTSDK封装个推服务,简化使用 - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-01-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README JQGeTuiService ==== 基于JQSOAppDelegate和GTSDK(个推SDK)封装APNS服务,简化使用 Installing ---- 编辑Podfile,集成JQGeTuiService, JQSOAppDelegate, GTSDK: ``` # Uncomment this line to define a global platform for your project platform:ios,'8.0' inhibit_all_warnings! target 'MyApp' do # 集成个推SDK(GTSDK) pod 'GTSDK', '2.1.0.0-noidfa' # 集成JQSOAppDelegate pod 'JQSOAppDelegate', :git => 'https://gitee.com/zjq_net/JQSOAppDelegate.git', :tag => '0.1.0' # 集成JQGeTuiService pod 'JQGeTuiService', :git => 'https://gitee.com/zjq_net/JQGeTuiService.git', :tag => '0.1.0' end ``` 使用 ==== AppDelegate.h ---- ``` #import #import @interface AppDelegate : JQSOAppDelegate @end ``` AppDelegate.m ---- ``` #import "AppDelegate.h" /// 个推 #define kGtAppId @"Your getui app id" #define kGtAppKey @"Your getui app key" #define kGtAppSecret @"Your getui app secret" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. ///------------------------------------------------------------------------------------------┐ // This file is NOT neccessary. You can use JQSOAppDelegate directly, without any subclasses.│ ///------------------------------------------------------------------------------------------┘ // Do something before all other app services // ... [self initServices:launchOptions]; // JQSOAppDelegate (the super) does not implement -application:didFinishLaunchingWithOptions: actually. // It forwards the message to all registered services. // You MUST call super to ensure all registered service implementation get called. if ([super respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) { [super application:application didFinishLaunchingWithOptions:launchOptions]; } return YES; } - (void)initServices:(NSDictionary *)launchOptions { [JQGeTuiService sharedInstance].gtAppId = kGtAppId; [JQGeTuiService sharedInstance].gtAppKey = kGtAppKey; [JQGeTuiService sharedInstance].gtAppSecret = kGtAppSecret; [JQGeTuiService sharedInstance].delegate = self; } #pragma mark 消息推送相关处理 /** * @brief 处理个推消息 */ - (void)GeTuiServiceDidReceiveGeTuiNotification:(NSDictionary *)notification { NSLog(@"[DEBUG]%@",notification[@"payload"]); NSLog(@"[DEBUG]-----接收到个推通知------"); } /** * @brief 处理远程苹果通知 */ - (void)GeTuiServiceDidReceiveRemoteNotification:(NSDictionary *)notification { NSLog(@"[DEBUG]%@",notification[@"message"]); NSLog(@"-----接收到苹果通知------"); } /** * @brief 获得注册成功时的deviceToken 可以在里面做一些绑定操作 */ - (void)GeTuiServiceDidReceiveDeviceToken:(NSString *)deviceToken { NSLog(@"[DEBUG]当前deviceToken:%@",deviceToken); } /** * @brief 获得个推注册成功时的clientId */ - (void)GeTuiServiceDidReceiveGeTuiClientId:(NSString *)clientId { NSLog(@"[DEBUG]个推当前clientId:%@",clientId); } @end ```