Instance Methods | |
| (void) | - setAPNSListener: |
| (void) | - setAPNS:succ:fail: |
| - (void) setAPNSListener: | (id< V2TIMAPNSListener >) | apnsListener |
1.1 Set the APNS listener
| - (void) setAPNS: | (V2TIMAPNSConfig *) | config | |
| succ: | (V2TIMSucc) | succ | |
| fail: | (V2TIMFail) | fail | |
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。