0

我正在使用 iPhone 的通讯录使用 telprompt 拨打号码:。带有空格和破折号的数字不起作用,而带有加号和数字的数字只能起作用。iphone 本身不允许输入它们,但与 mac 同步会得到很多(无效?)电话号码。允许使用哪些字符,为什么?

4

2 回答 2

3

尝试使用此代码,它只在电话号码字符串中留下数字:

NSString* phone = @"477 (38) 232-35-47";
//@"477 (38) 232-35-47"
phone = [[phone componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]] componentsJoinedByString:@""];
//@"477382323547"
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@", phone]]];
于 2012-01-16T09:40:47.703 回答
1

请参阅RFC 3966 的tel第 3 节“URI 语法” :电话号码的 URI

于 2011-05-30T14:51:17.263 回答