0

I'm using iOS6, and I cannot make dial to this number: *222*20#

Here is my code:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:*222*20#"]]];

When I run the script above nothing happens?
Or maybe, there are some restrictions for dialing numbers?!

Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97

1 Answers1

6

This is because your number contains * and #.

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.

Please check iPhoneURLScheme for more details.

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
  • 1
    @AlmasAdilbek: AFAK, there is no way. Because in some countries the *somenumber*some# is used for VAS offers. If you dial this number from your app, the user will be charged. That's why they prevent this. – Midhun MP Jan 17 '13 at 11:10