iOS拨打电话的3种实现方式

  

iOS实现拨打电话的方式:

  

<强>方法一,requestWithURL,此方法拨打前弹出提示

        NSMutableString *字符串=[[NSMutableString alloc] initWithFormat: @“电话:% @ @“136 * * * * 0000”);   UIWebView * callWebview=[[UIWebView alloc] init);   [callWebview loadRequest:(NSURLRequest requestWithURL: [NSURL URLWithString: string]]];   (自我。视图addSubview: callWebview];      

迅速代码:

        callWebview让callWebview=UIWebView ()。loadRequest (NSURLRequest (url: url(弦:“电话:136 * * * * 0000”)!)URLRequest)   self.view.addSubview (callWebview)      

方法二,openURL (telprompt),此方法拨打前弹出提示,据说会导致App Store审核不通过

        NSMutableString *字符串=[[NSMutableString alloc] initWithFormat: @“telprompt: % @ @“136 * * * * 0000”);   [[UIApplication sharedApplication] openURL: [NSURL URLWithString: string]],      

迅速代码:

  

方法三,利用openURL (tel),此方法在iOS 10.2之前不会添加弹框,需要自己处理,手动添加警告即可

        NSMutableString *字符串=[[NSMutableString alloc] initWithFormat: @“电话:% @ @“136 * * * * 0000”);   [[UIApplication sharedApplication] openURL: [NSURL URLWithString: string]],      

  

以上所述是小编给大家介绍的iOS拨打电话的3种实现方式,希望对大家有所帮助,如果大家有任何疑问欢迎给我留的言,小编会及时回复大家的!

iOS拨打电话的3种实现方式