1

On iOS, opening a tel link via

func open(_ url: URL, options: [String : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil)

or the older (for iOS 9 and older)

func openURL(_ url: URL) -> Bool

will make iOS display an UIAlertViewController and present it to the user on your behalf.

I can't seem to find a way to get a handle on this UIAlertViewController. I'd like to know when it's showing and when it's not.

Usually, if you instantiate and present a UIAlertViewController yourself, you can see if its displaying because

self.presentedViewController

will not be nil.

Essentially, there is a behavior I'd like to "pause" when a system-displayed alert is shown (such as the tel prompt) and then "resume" when it is dismissed.

I've looked around Apple's documentation and cannot seem to find anything on this. Any help is greatly appreciated!

Mario A Guzman
  • 3,483
  • 4
  • 27
  • 36
  • 2
    You can't get the alert since it is presented by iOS outside of your app. You will get a `willResignActive` and `didBecomeActive` delegate callback and `Notification` – Paulw11 Nov 13 '17 at 02:08
  • I was afraid of this but it's certainly better than nothing. Thanks. – Mario A Guzman Nov 13 '17 at 02:09
  • @MarioAGuzman This alert from the system side, you can't do anything right now. I mean current APIs does not allow to interact to this behavior. The system holds all of the responsibilities. From the release [notes](https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/) of iOS SDK 10.3: openURL When a third party application invokes `openURL`: on a `tel://`, `facetime://`, or `facetime-audio://` URL, iOS displays a prompt and requires user confirmation before dialing. – Mannopson Nov 13 '17 at 06:09

0 Answers0