nsurl* URL = [[Nsurl alloc] initwithstring:@ "Http://blog.csdn.net/iukey"];
[[UIApplication Sharedapplication]openurl:url];
nsurl* URL = [[Nsurl alloc] initwithstring:@ "tel:110"];
[[UIApplication Sharedapplication]openurl:url];
iOS Call call three ways
The first way of calling
[HTML] View plaincopy
- (void) makeacall{
NSString *number = @ "";//read in the phone number
NSString *num = [[NSString alloc] Initwithforma t:@ "tel://%@", number]; Number is a string if you end the call using this method, you will enter the contact list
}
//The second way to call [HTML] view plaincopy
- (void) makeacall{
NSString *num = [[NSString alloc] initwithformat:@ "telprompt://%@", number]; And this method to call before the box whether to call and then after the call back to the program online said this method may not be legal audit
[[UIApplication sharedapplication] Openurl:[nsurl Urlwithstring:num]]; Dial
}
//The Third way to call///The following code can add a phone button in the app, load the phone with UIWebView, this is legal, can be on the App Store. [HTML] View plaincopy-(void) makeacall{
NSString *phonenum = @ "";//Phone number
Nsurl *phoneurl = [Nsurl urlwithstring:[ns String stringwithformat:@ "tel:%@", Phonenum]];
if (!phonecallwebview) {
Phonecallwebview = [[UIWebView alloc] initwithframe:cgrectzero];// This webview is just a background view does not need to add to the page to effect the same as the method two but this method is legal
}
[Phonecallwebview loadrequest:[nsurlrequest Requestwithurl:phoneurl]];
}
iOS Issues Summary: 2014-12-10 calling Safari and initiating a phone call in a program