Instance Methods | |
| (void) | - setAPNSListener: |
| (void) | - setAPNS:succ:fail: |
| - (void) setAPNSListener: | (setAPNSListener(apnsListener:)) | NS_SWIFT_NAME |
1.1 Set the APNS listener
| - (void) setAPNS: | (V2TIMAPNSConfig *_Nullable) | config | |
| succ: | (_Nullable V2TIMSucc) | succ | |
| fail: | (setAPNS(config:succ:fail:)) | NS_SWIFT_NAME | |
1.2 Configure offline push
config -> token:Unique identification of the iphone device which can be obtained by actively calling the system API
// Example code showing how to obtain token
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[[UIApplication sharedApplication] registerUserNotificationSettings:
[UIUserNotificationSettings settingsForTypes:
(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}-(void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// The deviceToken param is the token we need.
}
config -> busiId:Certificate ID, which is generated after uploading the push certificate (p.12) to the IM console. For specific steps, please refer to Offline Push。