After switching to xcode 8 beta my push notifications have stopped working.
My code signing identity for release is set to distribution. I am registering the device, receiving the token and successfully uploading it to my server without any problem. But the status of the push messages is failed.
Just wondering if i need to make any changes or if it will not work with a beta version of xcode.
In the targets, under Capabilities and Push Notifications I needed to add the push notification entitlement to my entitlements file. This was done just by clicking the button that appeared here with the error message.
For me issue was when I registered for the first time I retrieved the token. But when I unregister the token and then try to re-register token, token delegate method is not called.
Now if I switch off and switch on the device, its working fine.
In my project push notifications correctly worked on iOS 9 and did't work on iOS 10. There is notification model in my project that allows to enable/disable push notifications from initial help screen and settings screen. And state of this model was based on UIUserNotificationSettings that can be received from the system (registerUserNotificationSettings: and currentUserNotificationSettings).
States:
1. UNDEFINED - currentUserNotificationSettings is equal to nil or categories count is equal to 0
2. APLIED - currentUserNotificationSettings are equal to those that were requested by registerUserNotificationSettings:
3. DENIED - currentUserNotificationSettings are not equal...
As I said, on iOS 9 this model works well but in iOS 10 it's state never becomes UNDEFINED because categories count of currentUserNotificationSettings is not equal to zero even if app was reinstalled.
So model's state becomes DENIED on start of the application and it doesn't call registerUserNotificationSettings: at all (it assumes that user has denied push notifications).