我有以下代码:
phoneNumber = (NSString*)CFBridgingRelease(ABMultiValueCopyValueAtIndex(phones, i));
NSString *phoneNumberURLString = [[NSString alloc] initWithFormat:@"tel://%@", phoneNumber];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneNumberURLString];
[[UIApplication sharedApplication] openURL:phoneURL];
然而,问题在于,有时某个电话号码不会被呼叫:例如,如果phoneNumber是(520)123-1232,那么这不会拨打电话。有关如何对电话号码格式进行标准化以使此方法适用于所有情况的任何想法吗?
答案 0 :(得分:0)
这是数字中的空格。空格不是有效的URL字符。必须将其编码为%20
。