我在我的应用程序中使用了远程通知,但在使用iPhone 4或iPhone 4s时注册失败。对于iPhone 6和其他版本,注册是没有问题的。我在网上搜索这道题。这是因为错误的证书。所以我不理解它。为什么iPhone 6或iPhone 5可以成功注册,而iPhone 4或4s则不能。可能是系统版本的问题。我该如何解决这个问题?

发布于 2016-03-16 17:17:40
试试下面的代码:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}https://stackoverflow.com/questions/36031073
复制相似问题