问题
I hope to call with * character. ex> *711313.
Currently, I'm using this code:
NSString *str = [NSString stringWithFormat:@"tel:%@", tmp];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
I tested two cases:
tmp = @"719929292"; //this is ok. make call.
tmp = @"*7128282"; //app no reaction. not to call.
How can I call with *(star character)?
回答1:
The star may have to be encoded for use in a URL. Try %2A
instead of *
.
This replacement is not done by stringByAddingPercentEscapesUsingEncoding:
since *
is a valid URL character, albeit with a special meaning.
来源:https://stackoverflow.com/questions/12909631/how-to-call-dialing-with-char-in-ios