iOS8でデバッグしていると以下のようなエラーメッセージが表示された。
registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later. |
ちなみにiOS7以前までは、
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];としていた。
今回、iOS8では下のように変更した。
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications];確かに動いたけど、なんか釈然としないなー。
0 コメント:
コメントを投稿