最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
iOS拨打电话的3种实现方式
时间:2022-06-26 05:46:59 编辑:袖梨 来源:一聚教程网
iOS实现拨打电话的方式:
方法一、requestWithURL,此方法拨打前弹出提示
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"136****0000"]; UIWebView * callWebview = [[UIWebView alloc] init]; [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:string]]]; [self.view addSubview:callWebview];
swift代码:
let callWebview = UIWebView()callWebview.loadRequest(NSURLRequest(url: URL(string: "tel:136****0000")!) as URLRequest) self.view.addSubview(callWebview)
方法二、openURL(telprompt) ,此方法拨打前弹出提示,据说会导致App Store审核不通过
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"telprompt:%@",@"136****0000"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
swift代码:
方法三、利用openURL(tel),此方法在iOS 10.2之前不会添加弹框,需要自己处理,手动添加alert即可
NSMutableString * string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"136****0000"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
相关文章
- QQ经典版app最新版本下载-QQ经典版app官方正版iOS苹果版下载入口 03-14
- picacg哔咔下载入口-PicACG官方导航 03-14
- 番茄免费全本小说畅读-番茄免费全本小说完结畅读 03-14
- 小米云服务入口在哪-小米云服务官网登录地址详解 03-14
- 漫蛙漫画官方登录入口-漫蛙2漫画app免费下载 03-14
- picacg哔咔注册验证?2026picacg哔咔一键注册指南 03-14