【发布时间】:2016-01-11 09:47:12
【问题描述】:
我有一个使用以下代码启用推送通知的 iOS 应用
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
// iOS < 8 Notifications
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
当这个应用程序在 iOS9 设备上运行时,它一开始就要求权限,但在 iOS7 和 iPhone 4 上使用时,它不会要求权限,但它接收通知很好,无法理解问题.
【问题讨论】:
-
如果您的应用程序已经获得了操作权限,除非设备重置或应用程序卸载至少一天,否则它不会再请求它。您确定您之前没有授予您的应用在该 iPhone 4 上推送的权限吗?
-
用户说他从来没有被要求过
-
这意味着该应用程序确实具有权限,尽管在安装该应用程序之前。没有权限,他不可能收到任何推送。要求用户在设置菜单中检查应用程序的权限。他可能只是卸载了以前的版本,但立即卸载了你给他的最新版本
标签: ios objective-c apple-push-notifications ios-permissions