adrenalin
adrenalin

Reputation: 135

How to reset notifications settings for ios app

I want to enable my app to update applicationIconBadgeNumber. For this I use:

let settings = UIUserNotificationSettings(forTypes: .Badge, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
...
UIApplication.sharedApplication().applicationIconBadgeNumber = someNumber

And all works fine. But now I want that user will have an option to turn off/on this notifications inside my app, not in iOS settings.

I've tried to use UIApplication.sharedApplication().cancelAllLocalNotifications() but is doesn't work in my case.

How can I do it?

Upvotes: 1

Views: 650

Answers (1)

user2091595
user2091595

Reputation: 39

You need to implement the Settings Bundle and accordingly mention UI components to on/off inside your app. https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html

Upvotes: 1

Related Questions