プッシュ通知登録はお済みですか?
#define SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
if(SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0")){
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
if( !error ){
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
}];
}
return YES;
}
以下のデリゲート メソッドを実装しましたか?
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler{
//Called to let your app know which action was selected by the user for a given notification.
NSLog(@"Userinfo %@",response.notification.request.content.userInfo);
}
そして、このスレッドをチェックして、より多くの手がかりを得ることができますか
iOS 10 と 9 は異なるペイロード構造に従います。
iOS 10 に続く
{
"aps":{
"alert":{
"body":"YOUR_MESSAGE."
},
"badge":1
},
“YOUR_VARIABLE” : "YOUR VALUE"
}
iOS < 9 が続く
{
“aps” : {
“alert” : "YOUR_MESSAGE.”,
“badge” : 1,
“sound” : “default”
},
“YOUR_VARIABLE” : "YOUR VALUE"
}
これが問題かもしれないと思います