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)"