Enable or Disable Iphone Push Notifications inside the app

Sameera Chathuranga picture Sameera Chathuranga · May 9, 2012 · Viewed 30.2k times · Source

I have a iphone app which is enable to receive push notifications. Currently i can disable push notifications for my app by going to the iphone settings/Notifications.

But i want to add a switch or button inside my app to enable or disable push notifications.

It can be done because i saw it in foursqure iphone app did it. They got a section in settings call notification settings and user can enable or disable different kind of notification for the app.

I look all over the net to find a proper solution for this but still not found a way. Can any one please give any idea how to do that ?

Thanks in advance :)

Answer

Varun Bhatia picture Varun Bhatia · Jun 25, 2012

[FYI - Few users have reported that it stopped working on iOS 10]

You can easily enable and disable push notifications in your application by calling registerForRemoteNotificationTypes and unregisterForRemoteNotificationTypes respectively again. I have tried this and it works.