iOS-拨打电话三种方式(修改后)

1,这种方法,不弹出提示,直接拨打,打完电话后还会回到原来的程序

NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"1575539xxxx"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2,这种方法,打完电话后还会回到原来的程序,拨打前会弹出提示,可以上App Store

NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"1575539xxxx"];
UIWebView *callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];

3, 这种方法也会回去到原来的程序里(注意这里的telprompt),拨打前会弹出提示, 但是是私有方法,不能上App Store( ?)(未亲测)

NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"1575539xxxx"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]

注意:iOS10.2以后系统自带提示框,因此一般情况下选择第一种方法即可

原博文:http://blog.csdn.net/ouy_huan/article/details/30506925

猜你喜欢

转载自blog.csdn.net/JennyHermes/article/details/73344388