最近在开发项目中使用到调用系统的拨打电话的方法,但是发现存在很大的缺陷。点击号码后,拨打按钮的弹出很慢,这样对于用户的体验是很差。使用以下方法可进行优化:
- (void)callPhoneStr:(NSString*)phoneStr withVC:(UIViewController *)selfvc{
if (phoneStr.length == 0) {
return;
}
NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@", phoneStr];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
});
}