File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
8989}
9090````
9191
92- 4、为了在收到推送点击进入应用能够获取该条推送内容需要在 AppDelegate.m didReceiveRemoteNotification 方法里面添加 [[ NSNotificationCenter defaultCenter] postNotificationName: GT_DID_RECEIVE_REMOTE_NOTIFICATION object: userInfo ] 方法,注意:这里需要在两个方法里面加一个是iOS7以前的一个是iOS7即以后的,如果AppDelegate.m 没有这个两个方法则直接复制这两个方法,如下所示:
92+ 4、为了在收到推送点击进入应用能够获取该条推送内容需要在 AppDelegate.m didReceiveRemoteNotification 方法里面添加 [[ NSNotificationCenter defaultCenter] postNotificationName: object:] 方法,注意:这里需要在两个方法里面加一个是iOS7以前的一个是iOS7即以后的,如果AppDelegate.m 没有这个两个方法则直接复制这两个方法,如下所示:
9393
9494````
9595#pragma mark - APP运行中接收到通知(推送)处理 - iOS 10以下版本收到推送
@@ -115,7 +115,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
115115- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
116116
117117 NSLog(@"willPresentNotification:%@", notification.request.content.userInfo);
118- [[NSNotificationCenter defaultCenter]postNotificationName:GT_DID_RECEIVE_REMOTE_NOTIFICATION object:@{@"type":@"apns",@"userInfo":userInfo}];
118+ [[NSNotificationCenter defaultCenter]postNotificationName:GT_DID_RECEIVE_REMOTE_NOTIFICATION object:@{@"type":@"apns",@"userInfo":notification.request.content. userInfo}];
119119
120120 // 根据APP需要,判断是否要提示用户Badge、Sound、Alert
121121 completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
You can’t perform that action at this time.
0 commit comments