Skip to content

Commit 8136f30

Browse files
author
linwanting
committed
[update]:update iOS readme
1 parent 26d5b02 commit 8136f30

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

example/document/iOS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)