IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMManager(APNS)

Instance Methods

(void) - setAPNSListener:
 
(void) - setAPNS:succ:fail:
 

Method Documentation

◆ setAPNSListener:()

- (void) setAPNSListener: (id< V2TIMAPNSListener >)  apnsListener

1.1 Set the APNS listener

◆ setAPNS:succ:fail:()

- (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

Attention
  • Message offline push will be enabled after call the setAPNS API successfully. If you want to customize the format of the message when receive offline message, please refer to the sendMessage API in V2TIMManager+Message.h
  • If message offline push is enabled successfully, system push notification will be poped up when receive a message after the APP enters background.
  • After the APP enters the background, the SDK will set the APP icon badge number as the sum of all conversation unreads by default. If you need to customize the unreads of the APP, please monitor the V2TIMAPNSListener callback settings.
  • The SDK will not set the APP icon badge number when the APP is not initialized or successfully logged in. In this case, if you need to set the APP icon badge number, please call the system function setting by yourself.
  • If you want to disable offline push, please set config to nil.