USSD calls with * and # dont work iOS

I have an application that needs to make a USSD call, but on some devices the * and # don't work on the dialer, on others it does.

if let phoneNumber = ussdNumberTextfield.text {
    let encoded = "telprompt:\(phoneNumber)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
            if let url = URL(string: encoded) {
                if  application.canOpenURL(url){
                    DispatchQueue.main.async {
                        self.application.open(url, options: [:]) { success in
                            
                        }
                    }
                }
            }
        }

Have you tried percent encoding the # and *? %23 and %2A

Yes, but it still doesn't work. When I put %, # or * the method (application.canOpenURL) is successful, but it does not open the dialer. only works with numbers

USSD codes are an ongoing source of weird compatibility problems. I’d like to clarify what you mean by “some devices”. Have you hit a case where two iPhones running identical versions of iOS are showing different behaviour? That is, one works and one fails?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

USSD calls with * and # dont work iOS
 
 
Q