私はXCode 8 Beta、iOS 10 Versionでプッシュ通知を行っています。デバイス上でプッシュ通知を受信しました。通知をクリックすると、UNUserNotificationCenterDelegateの代理人が起動しましたが、アプリケーションが開かれましたが、userinfoに応答が表示されませんでした。サーバー側のiOS 10でプッシュを送信するためのパラメータを変更する必要がありますか。以下は私のコードです。 iOSの9でiOS:iOS 10で辞書情報が表示されないプッシュ通知
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[application registerUserNotificationSettings:settings];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!error) {
NSLog(@"request authorization succeeded!");
}
}];
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
NSLog(@"Notification is triggered");
completionHandler(UNNotificationPresentationOptionAlert);
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler {
NSLog(@"Tapped in notification");
NSLog(@"%@",response.notification);
NSString *actionIdentifier = response.actionIdentifier;
if ([actionIdentifier isEqualToString:@"com.apple.UNNotificationDefaultActionIdentifier"] ||
[actionIdentifier isEqualToString:@"com.apple.UNNotificationDismissActionIdentifier"]) {
return;
}
}
、
aps = {
alert = "Multi extra param push.";
badge = 0;
sound = default;
};
t = I;
url = "http://www.google.com";
とiOSの10
alert = "Multi extra param push.";
badge = 0;
sound = default;
なぜiOS版ベータ版を使用していますか? – Rushabh
このNSLogを試してください(@ "%@"、[response.notification.request.content.userInfo objectForKey:@ "aps"]); –
iOS 9 aps = { alert = "複数の追加パラメータプッシュ"; バッジ= 0; sound =デフォルト; }; t = I; url = "http://www.google.com"; iOS 10ではalert = "複数の追加パラメータプッシュ"; バッジ= 0; sound =デフォルト; – Kashif