I develop an app, which builds itself around push notifications. The app requests notification permissions only when the user reaches certain point of the registration process. I have already managed to do the following:
NSUserDefaults
variable, which indicates if it is required to register for push at launch or not (by default: not)-registerForRemoteNotificationTypes:
on iOS 7 and -registerUserNotificationSettings:
on iOS 8This works fine unless the user has already enabled push notifications and then disabled them later in the Settings. In this case I try to reregister Push at launch, which does not call either -application:didRegisterForRemoteNotificationsWithDeviceToken
nor -application:didFailToRegisterForRemoteNotificationsWithError
.
Additional information, that iOS 8's -isRegisteredForRemoteNotifications
also returns YES
. (I did not test but suppose that -enabledNotificationTypes
works upto iOS 7.)
How can I detect this scenario and present the user a requester which asks him to reenable notifications in the Settings?
Remote images and icons, adding an image to your notification could cause the notification to be delayed as it has to wait to download the full image(s) first. Try omitting your image(s) temporarily to rule this factor out. Doze Mode can delay notifications even when sending with the highest priority.
Notification Delay will allow you to set a period of time that we'll wait before we send you notifications about issues. If an issue is resolved during that delay period, the notification will be discarded and you won't receive any emails from us.
[[UIApplication sharedApplication] isRegisteredForRemoteNotifications];
Returns a Boolean indicating whether the app is currently registered for remote notifications.
Declaration SWIFT func isRegisteredForRemoteNotifications() -> Bool OBJECTIVE-C - (BOOL)isRegisteredForRemoteNotifications Return Value YES if the app is registered for remote notifications and received its device token or NO if registration has not occurred, has failed, or has been denied by the user.
Discussion This method reflects only the successful completion of the remote registration process that begins when you call the registerForRemoteNotifications method. This method does not reflect whether push notifications are actually available due to connectivity issues. The value returned by this method takes into account the user’s preferences for receiving push notifications.
Availability Available in iOS 8.0 and later.
Link to Apple Doc's
I would file a bug report at Apple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With