首先,注冊就不說了抚笔,主要說說在前后臺以及app殺死狀態(tài)下點擊推送消息會調用的方法:
(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處于后臺或者殺死狀態(tài)下的話會調用方法3
在iOS10當app處于前臺狀態(tài) 下會調用方法4
在iOS10以下app處于殺死狀態(tài)下或者后臺的的話會調用方法1和2
在iOS10以下app處于前臺的話會調用方法3
在這里記錄下集成環(huán)信和極光是遇到的問題(兩者都是Cocopods集成的)崭参,iOS10以上極光
//(JPush對系統的方法進行了封裝)
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler;
//JPush封裝后的:- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler?
這導致環(huán)信調用不到系統的方法整慎,無法收到推送声诸。