我在安装 ios9.3 后没有获得 devicetoken,但之前在 ios9.2.1 中运行良好。
这是代码(没什么特别的)
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else {
// iOS < 8 Notifications
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
最佳答案
如果您使用的是测试版,则可能会出现此问题。检查Apple Forum ;有些人对 beta 版本有同样的提示,所以它可以在 iOS beta 版本中被告知 bug
。
关于ios - 在 ios9.3 中未获取 devicetoken 或未调用 didfailRemotenotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36889248/