在App Store中发布了一个iOS 5.0+应用程序,可以显示员工个人资料及其电话号码。该应用的用户可以点击电话号码,这些号码将在他们的iPhone上拨打。
问题是某些 iPhone 4 的用户报告说它没有拨号。
这是我用来拨打的代码:
NSString *cleanedString = [[self.member.phone componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789-+()"] invertedSet]] componentsJoinedByString:@""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", escapedPhoneNumber]];
[[UIApplication sharedApplication] openURL:urlText];
有关于此的任何想法吗?
答案 0 :(得分:4)
/
计划中不应该有tel:
:
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", escapedPhoneNumber]];
在Apple URL Scheme Reference中,您可以看到tel:
方案中允许的内容的一些示例。
答案 1 :(得分:0)
如果您使用 telpromt 而不是 tel ,则会在您的通话结束后返回应用程序|
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt:1234567890"]];