We can check if push notifications are enabled with the help [[UIApplication sharedApplication] enabledRemoteNotificationTypes]that returns UIRemoteNotificationTypeNoneif they are not.
However, this does not distinguish fragmented cases when the user has not yet been asked to indicate push notifications, they have been offered and rejected, or they went into the settings and turned off notifications.
Is there a way to determine which one? In front of the official permissions dialog, I use pre-prompt , so I need to distinguish between these cases. Tracking with NSUserDefaults will not work, because the user can download the application, disable push permissions in the settings, and then reinstall the application. This clears the saved NSUserDefaults, but unfortunately does not clear their push permissions in the settings, which forces me to prompt the user again even if it is not possible to show the official dialog again.
Erich source
share