我不想显示"要求获得通知许可"对话框,只需将我的应用程序的禁用设置添加到设备设置中。
问题是如果应用程序没有请求这些权限,那么相关设置根本不会出现在设备设置中。
我的呼叫权限对话框代码:
UIUserNotificationType types = UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge;
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
你能帮忙解决这个问题吗?目前我只使用本地通知
答案 0 :(得分:1)
答案 1 :(得分:-1)
我在我的应用中使用它来接收推送通知: -
// Let the device know we want to receive push notifications
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)];
}