TIMEX TIMEX - 1 month ago 11
Objective-C Question

isRegisteredForRemoteNotifications returns true even though I disabled it completely

if UIApplication.sharedApplication().isRegisteredForRemoteNotifications() == true {
println("Yes, allowed")
println(UIApplication.sharedApplication().isRegisteredForRemoteNotifications())
}else{
//don't do shit
return
}


When I go to settings to turn off notifications completely and then go back in the app, the app still prints
true
, allowed.

I can't seem to make it trigger false, even after an app uninstall/reinstall.

Answer

As per the Apple documentation isRegisteredForRemoteNotifications will return NO if registration has not occurred, has failed, or has been denied by the user. YES will be returned if the app has registered for remote notifications and has received is device token. So in answer to your question NO it will not always return no it will also return yes if a your app has registered for remote notifications and it has received it device token.

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 remote notifications are actually available due to connectivity issues. The value returned by this method takes into account the user’s preferences for receiving remote notifications.

Above point return into apple document.

-----EDITED----------

You can read your app's permissions using

UIRemoteNotificationType enabledTypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; 

Then performing a any operation with the different types to see which are enabled. You can also call unregisterForRemoteNotifications to disable notifications.

-----Changes------

- 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 remote notifications are actually available due to connectivity issues. The value returned by this method takes into account the user’s preferences for receiving remote notifications.

Comments