在 iPhone 上确定用户是否启用了推送通知 [英] Determine on iPhone if user has enabled push notifications

查看:28
本文介绍了在 iPhone 上确定用户是否启用了推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来确定用户是否通过设置为我的应用程序启用或禁用了他们的推送通知.

I'm looking for a way to determine if the user has, via settings, enabled or disabled their push notifications for my application.

推荐答案

调用 enabledRemoteNotificationsTypes 并检查掩码.

例如:

UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types == UIRemoteNotificationTypeNone) 
   // blah blah blah

iOS8 及以上:

[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]

这篇关于在 iPhone 上确定用户是否启用了推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆