From 8ccdbd525b9450a4b36d70f6b2d4f76311d0be36 Mon Sep 17 00:00:00 2001 From: huangminlinux <380108184@qq.com> Date: Tue, 6 Feb 2018 14:32:12 +0800 Subject: [PATCH] fix app not launch open notification will fire twice bug --- src/ios/Plugins/AppDelegate+JPush.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ios/Plugins/AppDelegate+JPush.m b/src/ios/Plugins/AppDelegate+JPush.m index fe0c50d..fd2ce49 100644 --- a/src/ios/Plugins/AppDelegate+JPush.m +++ b/src/ios/Plugins/AppDelegate+JPush.m @@ -40,7 +40,8 @@ NSDictionary *_launchOptions; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]]; }]; - if (notification) { + if (notification != nil && + [[UIDevice currentDevice].systemVersion floatValue] < 10.0) {// iOS 10 以后通过 openNotification 这个回调触发事件。 if (notification.userInfo) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { @@ -136,9 +137,6 @@ NSDictionary *_launchOptions; [JPUSHService handleRemoteNotification:userInfo]; NSString *eventName; switch ([UIApplication sharedApplication].applicationState) { - case UIApplicationStateInactive: - eventName = JPushDocumentEvent_OpenNotification; - break; case UIApplicationStateActive: eventName = JPushDocumentEvent_ReceiveNotification; break;