Enable Notifications after Initial Deny

Hi


Users are prmpted for the Push Notification permission when they first download and launch the app. If the user taps "Don't Allow", the user has no way to turn on notifcations unless the app is removed, downloaded and launched again.


I would have thought even if the toggle was disabled Notifications would appear in the Settings > My App > Notifications.


Anyone has some ideas as to what the best practice is to provide the user the ability to enable notifications at a later stage if initially they denied the permission?


Thanks


Craig

Hi


After playing around with the code and testing the various scenarios, I came up with this approach that seems to work.


// Register for notifications.
UIApplication.shared.registerForRemoteNotifications()


let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.requestAuthorization(options: [.badge, .sound, .alert])
{
   granted, error in
            
   DispatchQueue.main.async
   {
   NSLog("\tRegistering for push notifications permission granted \(granted).")
   if let error = error
   {
      NSLog("\tPush notifications permission error \(error.localizedDescription)")
   }
}


So register for remote push first, which if the user taps "Don't Allow" will still add Notification to the app settings, just toggled off. At some later stage the user can go into the app settings and toggle Notifications on to start receiving push notications.


Thoughts?

Enable Notifications after Initial Deny
 
 
Q