user1155543
user1155543

Reputation: 31

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

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?

Upvotes: 3

Views: 1746

Answers (1)

Alladinian
Alladinian

Reputation: 35686

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

Upvotes: 1

Related Questions