Ask permission to use specific query schemas on iOS 10

240 Views Asked by At

After had set the scheme of queries to do ininfo.plist file:

<key>LSApplicationQueriesScheme</key>
<array>
    <string>telprompt</string>
    <string>fb-messenger</string>
    <string>tel</string>
</array>

I would like to open the phone prompt in this way:

   'let url = URL(string: "telprompt://\(self.offertaObj.callNumber)")
    if UIApplication.shared.canOpenURL(url!) {
        UIApplication.shared.open(url!)

    }else{
        self.view.makeToast("Contattaci al numero: "+self.offertaObj.callNumber, duration: 3, position: .bottom)
    }

I will receive always the message that the app isn't allowed to open that query scheme, meanwhile I didn't found any reference about how to ask to the user to allow it with toast messages.

1

There are 1 best solutions below

2
On BEST ANSWER

Now in ios , schema has been change for perform call from application. Refer below code for perform call.

guard let url: URL = URL(string: "tel://" + "\(phoneNumber)") else {
                                print("Error in Making Call")
                                return
                            }
                            if #available(iOS 10.0, *) {
                                UIApplication.shared.open(url, options: [:], completionHandler: nil)
                            } else {
                                // Fallback on earlier versions
                                UIApplication.shared.openURL(url)
                            }