remy boys remy boys - 1 year ago 69
iOS Question

Ask for Notification permission After sign up (no just after app starts)

can we change the default behaviour of Permission seeking method (it appears when we launch the app ) but i want to show it when user is signed up , i'm doing this in my appDelegate:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)


application.registerUserNotificationSettings(notificationSettings)

return true
}

Answer Source

You can place it in different classes where you want to ask user like below

let notificationSettings = UIUserNotificationSettings(
            forTypes: [.Badge, .Sound, .Alert], categories: nil)

UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)