0

Is there any way to detect whether Apple push permission alert box is visible on screen or not?

As my knowledge, we can determine whether user has disallowed or allowed push permission, but I am not sure about whether we can detect alert box is presented on screen or not.

I checked Apple documentation but no luck.

Solution should work for ios 9.0 and above

  • See the accepted answer: "In iOS 7 [and above], when the system's push notification prompt appears, the app becomes inactive and UIApplicationWillResignActiveNotification fires." I just implemented this in an iOS 9 app. `applicationWillResignActive` will get called without the app actually entering the background (`applicationDidEnterBackground`). – JAL Mar 19 '17 at 01:09
  • But applicationWillResignActive is not dedicated call back for apple prompt, in other scenarios also this method get call. My question is specific to push permission dialog –  Mar 19 '17 at 01:17
  • Right, there is no dedicated callback to know when this alert is being presented. You have to assume that if you haven't asked for permissions before, and then call `.registerForRemoteNotifications()`, the prompt will show up. – JAL Mar 19 '17 at 01:19

0 Answers0