开发者

Dialing a command prefix on the iPhone

Our application lets users call phone numbers. Users would like to be able to block their caller ID.

On other platforms, we let the user specify a custom dialing prefix. For instance, on my cell provide开发者_开发问答r it's #31#.

I've tried two approaches so far.

First:

id url = [NSURL URLWithString: @"tel:#31#0000000"]
// produces nil

Second:

id encoder = ["#31#0000000" stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
// produces %2331%230000000
id url = [NSURL URLWithString: [NSString stringWithFormat: @"tel:%@", encoded]];
// produces a valid-looking NSURL which doesn't do anything

I'm thinking at this point that I'm just not allowed to dial # and *, even from a Cocoa touch application. (I know it's not allowed from a web app.) Is this true, or am I missing something obvious?


It looks like there's intentionally no way to do this.

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.

— Apple URL Scheme Reference Phone Links

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜