Is there a way to programmatically unregister a device for push notification?

The push notifications are sent from your server... so you should implement such a method yourself and remove or disable the device in the database on your server where you store the active devices.

If you only disable them locally on your device your server will still send messages until you get notification from the feedback service.. which you should check...


For Swift 4 and above

UIApplication.shared.unregisterForRemoteNotifications()

You can call this method after a user logout that you will be sure that the next user to connect will have a unique device token.


[[UIApplication sharedApplication] unregisterForRemoteNotifications] should be used, in Objective-C.

UIApplication.shared.unregisterForRemoteNotifications() in Swift.