iphone - 了解应用程序是否有权实时接收推送通知

标签 iphone push-notification apple-push-notifications

考虑这种情况。应用程序运行,并且 application:didRegisterForRemoteNotificationsWithDeviceToken: 接收到该应用程序有权接收推送通知的信息。

用户将应用置于后台,并删除应用接收设备配置通知的授权。

用户再次运行应用程序。从后台返回后,应用程序仍然认为它有权接收推送通知。此时 application:didRegisterForRemoteNotificationsWithDeviceToken:application:didFailToRegisterForRemoteNotificationsWithError: 都不会收到任何信息。

有没有办法在任何给定点知道应用程序是否有权接收推送通知(从设备的通知首选项中读取某些内容)?

谢谢。

最佳答案

每次应用从后台返回时,您都可以检查[[UIApplication sharedApplication]enabledRemoteNotificationTypes]

参见:iOS - Check for push notification support in the app

Once I have verified that the user has it disabled is there a way to programmatically direct the user to the notification settings on the device's configuration?

对于较新的 iOS 版本,否。根据Navigate to settings screen in iphoneiOS Launching Settings -> Restrictions URL Scheme ,您可以使用 -[[UIApplication sharedApplication] openURL:] 导航至设置屏幕,但仅限于运行 iOS 5.0 及更早版本的设备。

关于iphone - 了解应用程序是否有权实时接收推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14522246/

相关文章:

iOS 推送通知仅由开发设备接收

ios - ABRecordCopyValue() EXC_BAD_ACCESS Error while getting kABPersonFirstNameProperty

iOS UILocalNotification 仅在应用程序未运行时发出声音(无警报)

iphone - 如何减少初始化 View Controller 的时间

android - builder.setAutoCancel(true) 不工作

ios - Expo - 实现通知设置应用程序图标角标(Badge)编号

android - 单击关闭按钮后如何关闭通知对话框,而不调用任何 Activity

ios - ios 8 解析推送中没有声音

iphone - 供应概况

iphone - long double 的格式说明符(我想截断小数点后的 0)