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.

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 Set the APNS config params

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];
  [[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

  • 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.
  • The unread count of the APP will default to the sum of the unread messages of all conversations after the APP enters background. You can set V2TIMAPNSListener to customize the unread count of the APP when enter background.
  • If you want to disable offline push, please set config to nil.