Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unregister remote notification on logout

About unregisterForRemoteNotifications

From the apple doc

You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.

Some are saying:

Calling it would at times put the app in a state where calling registerForRemoteNotifications would no longer work.

Why did apple tell us to use it in rare circumstances only and gave such an extreme example of if new version of app removes push notification support completely. Isn't it fit for the logout button action?

In our app users can login with multiple devices. It would be lot easier if unregisterForRemoteNotifications works well. Anybody using unregisterForRemoteNotifications on logout button?

like image 762
Warif Akhand Rishi Avatar asked Sep 09 '16 11:09

Warif Akhand Rishi


1 Answers

Yes, You can use unregisterForRemoteNotifications on Logout.

This function is used to unregister all the notification from Apple Store.

You always can re register to notification with registerForRemoteNotifications and start receiving the push notification. And that you may need to do it in your success Login.

If you read that sentence from Apple Doc carefully than its last line clearly says that Apps unregistered through this method can always re-register.

They are suggesting developers if they dont want to receive push notification for some time than they can just simply disable from the settings. But for login and logout session you are doing right with by calling unregisterForRemoteNotifications

And New version will stop receiving notification means after your logout you will never receive any notification till you re register for it.

like image 68
haresh Avatar answered Nov 14 '22 21:11

haresh