we are looking for a way to find out (not modify, just find out) if our application has been allowed to receive notifications or not from our service. This pr开发者_运维知识库obably requires read-only access to the "general settings" properties or some specific API's. Does anybody know how to get that information? I am talking about the info in iPhone --> Settings --> Notifications
For those who are interested, this is the rationale: we are having some issues with users pressing NO when asked to allow our application to receive push notifications. As you can imagine, users might just press no because they are racing through registration or because they don't quite understand what is happening, or simply because they are not too sure whether they should allow the application to get notifications. But then they forget they denied permission so file support requests because they don't receive push notifications.
Call -[[UIApplication sharedApplication] enabledRemoteNotificationTypes]
. From the docs:
The values in the returned bit mask indicate the types of notifications currently enabled for the application. These types are first set when the application calls the registerForRemoteNotificationTypes: method to register itself with Apple Push Notification Service. Thereafter, the user may modify these accepted notification types in the Notifications preference of the Settings application. This method returns those initial or modified values.
-enabledRemoteNotificationTypes is deprecated.
It is recommended that you use the simple boolean instead:
[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]
精彩评论