首先,注册就不说了,主要说说在前后台以及app杀死状态下点击推送消息会调用的方法:
(1) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
(2) - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
(3) - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
(4) - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
在iOS10当app处于后台或者杀死状态下的话会调用方法3
在iOS10当app处于前台状态 下会调用方法4
在iOS10以下app处于杀死状态下或者后台的的话会调用方法1和2
在iOS10以下app处于前台的话会调用方法3
在这里记录下集成环信和极光是遇到的问题(两者都是Cocopods集成的),iOS10以上极光
//(JPush对系统的方法进行了封装)
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler;
//JPush封装后的:- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler
这导致环信调用不到系统的方法,无法收到推送。