简体   繁体   中英

Is there a way to make a hidden call from an iOS app through the telprompt URL scheme?

I can make a phone call with this code:

if let url = URL(string: "telprompt://\(number)"), UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

Now I want to make a phone call with hidden phone number, so I would add #31# but then url is not, and the canOpenURL function is not even called.

if let url = URL(string: "telprompt://#31#\(number)"), UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

tel:// scheme responds the same, and I don't want to go in the system settings and change it there, as it would hide my number on every call I make.

Any idea?

Xcode 11.5 - macOS Catalina - Swift 5

Have you tried url-encoding the # ?

"telprompt://%2331%23\(number)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM