Search code examples
iosswiftxcodeexternalopenurl

Open phone app with auto populated number in Swift


Is there a way to open the phone app using swift? all the answer I see was to use UIApplication.shared.open(urlNumber) like this. but it's not opening the phone app, instead, it will create a pop up and a cancel or call option.

This is my expected output expected output

the code that I was using right now was

guard let number = URL(string: "tel://" + "+639123123123") else { return }
UIApplication.shared.open(number, options: [:], completionHandler: nil)

but like I said, it didn't open the phone app and the output of that code was this, which is not what I expect.

enter image description here

Android achieved it in here, how about the ios?


Solution

  • Its not possible to open direct phone app without dialogue. As Per Apple's documentation for openURL:

    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.