在没有提示的情况下从 UIWebView 调用 phone
Make a phone call from UIWebView without prompt
场景
我有一个 UIWebView
的应用程序,我做了一些 url 覆盖要求。
问题
在 iOS7
和 iOS8
中使用 tel:
进行调用打开 url
很奇怪,它使 phone 直接在后台调用,但它也要求确认,所以用户体验很糟糕:
[[UIApplication sharedApplication] openURL:request.URL];
解决方案
为了解决这个问题,我使用了telprompt
。它适用于所有 iOS
版本:
NSURL *url = [NSURL URLWithString:@"telprompt://637****"];
return [[UIApplication sharedApplication] openURL:url];
但显示此确认对话框:
问题
现在,我有一个新的要求,即在没有确认或提示的情况下进行 phone 调用。所以... 有什么方法可以在 iOS
中进行 phone 调用而忽略确认提示?
我想要类似的东西
NSURL *url = [NSURL URLWithString:@"telnoprompt://637******"];
return [[UIApplication sharedApplication] openURL:url];
NSMutableCharacterSet *characterSet =[NSMutableCharacterSet characterSetWithCharactersInString:@" "];
NSArray *arrayOfComponents = [phone_number componentsSeparatedByCharactersInSet:characterSet];
phone_number = [arrayOfComponents componentsJoinedByString:@""];
NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phone_number];
NSString *escapedUrlString = [phoneURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *phoneURL = [NSURL URLWithString:escapedUrlString];
场景
我有一个 UIWebView
的应用程序,我做了一些 url 覆盖要求。
问题
在 iOS7
和 iOS8
中使用 tel:
进行调用打开 url
很奇怪,它使 phone 直接在后台调用,但它也要求确认,所以用户体验很糟糕:
[[UIApplication sharedApplication] openURL:request.URL];
解决方案
为了解决这个问题,我使用了telprompt
。它适用于所有 iOS
版本:
NSURL *url = [NSURL URLWithString:@"telprompt://637****"];
return [[UIApplication sharedApplication] openURL:url];
但显示此确认对话框:
问题
现在,我有一个新的要求,即在没有确认或提示的情况下进行 phone 调用。所以... 有什么方法可以在 iOS
中进行 phone 调用而忽略确认提示?
我想要类似的东西
NSURL *url = [NSURL URLWithString:@"telnoprompt://637******"];
return [[UIApplication sharedApplication] openURL:url];
NSMutableCharacterSet *characterSet =[NSMutableCharacterSet characterSetWithCharactersInString:@" "];
NSArray *arrayOfComponents = [phone_number componentsSeparatedByCharactersInSet:characterSet];
phone_number = [arrayOfComponents componentsJoinedByString:@""];
NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phone_number];
NSString *escapedUrlString = [phoneURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *phoneURL = [NSURL URLWithString:escapedUrlString];