[Original] comparison of the three call methods for iOS, and the three call methods for ios
Make a summary and comparison here.
1. Basic use
NSString * str = [[NSMutableString alloc] initWithFormat: @ "tel: // % @", @ "152xxxx4165"]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: str];
In this way, the original application cannot be returned after the phone is called. It will stay in the address book and be called directly. No prompt is displayed!
After iOS9.0, this method can return to the original application.
2. Recommended
UIWebView * webView = [[UIWebView alloc] init]; NSURL * url = [NSURL URLWithString: @ "tel: // 152 ***** 4165"]; [webView loadRequest: [NSURLRequest requestWithURL: url]; [self. view addSubview: webView];
This method will return to the original program after the phone is called, and a prompt will pop up!
3. It is not recommended to use it.
NSString * str = [[NSMutableString alloc] initWithFormat: @ "telprompt: // % @", @ "152xxxx4165"]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: str
Note that the difference between this method and method 1 is that the concatenated string is telprompt, not tel.
Note:
May not be able to pass online review