1:直接拨打, 不会弹出提示框
NSString *phone = [NSString stringWithFormat:@"tel:%@", @"150xxxxxxxx"];
[UIApplication.sharedApplication openURL:[NSURL URLWithString:phone] options:@{} completionHandler:nil];
2: 会弹出提示框
NSString *phone = [NSString stringWithFormat:@"tel:%@",@"150xxxxxxxx"];
UIWebView *callWebView = UIWebView.new;
[callWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:phone]]];
[self.view addSubview:callWebView];
3:会弹出提示框(注意:这里是telprompt, 推荐用这种)
NSString *phone = [NSString stringWithFormat:@"telprompt://%@",@"150xxxxxxxx"];
[UIApplication.sharedApplication openURL:[NSURL URLWithString:phone] options:@{} completionHandler:nil];
参考: https://www.jianshu.com/p/73872e332b24
网友评论