I am new to iOS development and I ran into a problem where I tried multiple solutions but couldn't fix it.
So what I want to do is, when I click on a button, make a phone call.
I already added this to my info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>telprompt</string>
<string>tel</string>
</array>
And this is my code for making the phone call:
func doCall() {
let url: NSURL = NSURL(string: "tel://1234567890")!
if UIApplication.sharesApplication().canOpenURL(url) {
UIApplication.sharesApplication().openURL(url)
} esle {
print("Call failed")
}
}
So when I actually click on button, the following error shows up in the console:
-canOpenURL: failed for URL: "tel://1234567890" - error: "(null)"
And when I remove theif
statement I am not getting that error but nothing happens. Also there is no phone app on the simulator, maybe that's the problem but I don't know either if that is resolvable.