小能集成接口使用说明

优质
小牛编辑
133浏览
2023-12-01

(1) 注册deviceToken、设置推送环境

/**
 上传服务器deviceToken

 @param deviceToken deviceToken
 @param isProduction 是否生产状态,Yes为生产环境, No为测试环境(Development)【上线前务必检查下】
 */

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ 
    //小能上传服务器deviceToken
    [[NtalkerPushManager sharedPushManager] ntalker_pushDeviceToken:deviceToken isProduction:self.isProduction];
}

(2)将后台或者被杀死状态推送过来的消息上传

/**
 应用后台推过来的推送消息

 @param userInfo 推送消息
 */
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{


 [[NtalkerPushManager sharedPushManager] ntalker_pushDidReceiveRemoteNotification:userInfo];

completionHandler(UIBackgroundFetchResultNewData);

}