嗨,在我的iOS应用程序中,我正在检查是否已启用推送通知,在iPad的设置中启用了我的应用程序的推送通知(ALLOW NOTIFICATIONS = yes,Alert样式为Banners)。
尽管在我的应用中 - 我收到的通知类型为UIRemoteNotificationTypeNone。
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types == UIRemoteNotificationTypeNone){
//Enters
}
此设备也未收到任何通知。这种情况只发生在我的iPad和iPod上,但在iPhone中工作正常。
为什么会这样,提前谢谢。
答案 0 :(得分:0)
在iOS 8中更改了注册推送通知的方法,请查看以下代码:
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}