Knowing that the push notification permission prompt on iOS has been shown in the past

I want to write new logic about how my app asks users for Push Notifications permission.

This involves showing the user a new screen before asking for permission.

Also, I want old users who have updated their app and already see the system prompt will not see this new screen.

How can I check that the user has already seen the prompt to allow push notifications?

+3


source to share


2 answers


Since iOS 10 it is now possible



 UNUserNotificationCenter.current().getNotificationSettings { (notificationSettings:UNNotificationSettings) in 
if notificationSettings.authorizationStatus != .notDetermined {
    // push notifications permission prompt on iOS has been shown in the past

}

      

+1


source


With the iOS SDK, you can only check if push notifications are enabled. Prior Ios 8

UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types != UIRemoteNotificationTypeNone){ has enabled notifications} 

      

from ios 8



[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]

      

Unable to check if one push notification invitation was shown once and the user declined it.

-1


source







All Articles