Every time this code runs, the results is YES. Even when I go into the "Settings" app and set push notifications to "off" for my app, when the code above runs, it evaluates to YES.
Other details: * I'm running the app on got an iphone that has iOS 8.1.3 * I'm running the app in Xcode 6.1 and I've got the phone physically attached to my machine
Any idea why the value of "isRegisteredForRemoteNotifications" doesn't change?
回答1:
Because iOS 8 does register the device and provides a Token even if the user opts out from pushes.
In that case pushes are not presented to the user when the push is sent, but if your app is running it gets the payload so you can update it when the app is running...
To check if push notifications are enabled in iOS 8 you should check for the enabled user notification types: