iOS:有没有办法知道用户是否选择退出通知?

标签 ios permissions push-notification apple-push-notifications

有了 CLAuthorizationStatus,我可以确切地知道用户是否拒绝了应用程序权限(kCLAuthorizationStatusDenied)或者状态是否未确定(kCLAuthorizationStatusNotDetermined) .

...那么通知服务是否有类似的东西?我似乎找不到任何东西,而且似乎无法区分拒绝权限的用户和尚未显示权限弹出窗口的用户。

最佳答案

if ([[[UIDevice currentDevice]systemVersion]floatValue] >= 8.0) {
    UIUserNotificationSettings *current = [[UIApplication   sharedApplication]currentUserNotificationSettings];
    if (current.types != UIUserNotificationTypeNone){
        NSLog(@"Notifications Enabled ios 8");
    } else {
        NSLog(@"Notifications not Enabled ios 8");
    }

} else {
    UIRemoteNotificationType types = [[UIApplication sharedApplication]enabledRemoteNotificationTypes];
    if (types != UIRemoteNotificationTypeNone)
    {
        NSLog(@"Notifications Enabled");
    }
    else
    {
        NSLog(@"Notifications not Enabled");
    }
}

关于iOS:有没有办法知道用户是否选择退出通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25929538/

相关文章:

Objective-C:类之间如何通信?

ios - 如何在 UINavigationBar 的右侧设置两个按钮?

ios - 获取权限后如何刷新权限

django - 如何从 Django 中的组中删除所有权限

Angular 7 PWA 配置推送通知

iOS状态保存: can I display a launch image instead of a snapshot

ios - 使用spritekit中的anchorPoint到每个节点

c - 写入文件时出现 "Permission denied"错误,但前提是该文件尚不存在

push-notification - 我如何使应用程序消息中的 wonderpush 用于订阅网络推送?

ios - 推送通知代码执行(强制退出应用程序)