iOS 应用未在 iOS7 台设备上请求权限
iOS app not asking for permissions on iOS7 device
我有一个 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 4s 上有一个先前的构建,他已授权推送通知。
- 他很快卸载了以前的版本并安装了你给他的最新版本,没有给设备一天的时间再重新安装。
- 结果是没有向他显示任何请求推送通知权限的对话,因为之前已经授予了权限。
The first time a push-enabled app registers for push notifications,
iOS asks the user if they wish to receive notifications for that app.
Once the user has responded to this alert it is not presented again
unless the device is restored or the app has been uninstalled for at
least a day.
If you want to simulate a first-time run of your app, you can leave
the app uninstalled for a day. You can achieve the latter without
actually waiting a day by following these steps:
Delete your app from the device. Turn the device off completely and
turn it back on. Go to Settings > General > Date & Time and set the
date ahead a day or more. Turn the device off completely again and
turn it back on
如果您要求您的用户在设置菜单中检查应用特定权限,他肯定会看到推送权限。否则他根本不会收到推送通知。
我有一个 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 4s 上有一个先前的构建,他已授权推送通知。
- 他很快卸载了以前的版本并安装了你给他的最新版本,没有给设备一天的时间再重新安装。
- 结果是没有向他显示任何请求推送通知权限的对话,因为之前已经授予了权限。
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
Delete your app from the device. Turn the device off completely and turn it back on. Go to Settings > General > Date & Time and set the date ahead a day or more. Turn the device off completely again and turn it back on
如果您要求您的用户在设置菜单中检查应用特定权限,他肯定会看到推送权限。否则他根本不会收到推送通知。