拨打 objective-c 无法正常工作的 IOS6 的电话



我尝试过下面的代码:

NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel://%@",[[dCliente objectAtIndex:1] stringByReplacingOccurrencesOfString:@"-" withString:@""]];
NSURL *url = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:url ];
[phoneStr release];
[url release];

有人可以告诉我可能有什么问题吗?我直接在iPhone上用IOS6进行了测试

这个怎么样:

NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",[[dCliente objectAtIndex:1] stringByReplacingOccurrencesOfString:@"-" withString:@""]];

感谢您的回答,问题是 tel://和电话号码之间的空格。我这样做了:

stringByReplacingOccurrencesOfString:@" " withString:@""

删除tel:和数字之间的//。请参阅iOS 5电话链接不起作用。

最新更新