Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dial a phone number with "##"?

Tags:

iphone

I want to dial a phone number like "##8004664411" in IPhone.

If I dial the number "8004664411",it works.But if the number contains the symbol"##",it doesn't work.

Here is the code that I am using which is not working:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://##8004664411"]];

Is the escape character wrong?

like image 551
user1155543 Avatar asked Dec 04 '25 16:12

user1155543


1 Answers

I am afraid that you simply cannot dial a number containing * or # characters. It seems that Apple doesn't allow them in a dial string for security reasons. Below is the relevant part of the documentation.

From Apple's documentation:

To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone application supports most, but not all, of the special characters in the tel scheme. Specifically, if a URL contains the * or # characters, the Phone application does not attempt to dial the corresponding phone number. If your application receives URL strings from the user or an unknown source, you should also make sure that any special characters that might not be appropriate in a URL are escaped properly. For native applications, use the stringByAddingPercentEscapesUsingEncoding: method of NSString to escape characters, which returns a properly escaped version of your original string.

Note: The stringByAddingPercentEscapesUsingEncoding: part does not apply to * and # (I've tried it yes...)

like image 50
Alladinian Avatar answered Dec 06 '25 06:12

Alladinian