iOS10.0后拨打系统电话延迟现象严重;
点击查看openURL方法查看
- (BOOL)openURL:(NSURL*)url NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead")
iOS10.0后让我们用openURL:options:completionHandler:代替;
上代码
方法一:
if (_telPhone.length == 0) {
return;
}
NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@", _telPhone];
CGFloat version = [[[UIDevice currentDevice]systemVersion]floatValue];
if (version >= 10.0) {
/// 大于等于10.0系统使用此openURL方法
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone] options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
}
方法二:也可以写个线程
if (_telPhone.length == 0) {
return;
}
NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@", _telPhone];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
});