NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@", CUSTOMER_SERVER_LINE];
NSURL *url = [[NSURL alloc] initWithString:telUrl];
BOOL iseffective = [[UIApplication sharedApplication] openURL:url];
if (!iseffective) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"该设备不支持电话功能,请更换设备" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
NSURL *url = [[NSURL alloc] initWithString:telUrl];
BOOL iseffective = [[UIApplication sharedApplication] openURL:url];
if (!iseffective) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"该设备不支持电话功能,请更换设备" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
或者
UIWebView*callWebview =[[UIWebView alloc] init];
NSString *telUrl = [NSString stringWithFormat:@"tel:%@",phone];
NSURL *telURL =[NSURL URLWithString:telUrl];// 貌似tel:// 或者 tel: 都行
[callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
//记得添加到view上
[self.view addSubview:callWebview];