iOS应用拨打电话
2014-06-29 16:00
155 查看
关于iOS应用拨打电话, 我所知道的有3种办法, 具体如下:
[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
}
注意: Apple的官方文档中, 没有出现过telprompt, 之前也有人使用这个, 上传审核的时候被拒绝了。
[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
一。利用openURL(tel)
特点: 直接拨打, 不弹出提示。 并且, 拨打完以后, 留在通讯录中, 不返回到原来的应用。[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
二。利用requestWithURL (推荐使用)
特点: 拨打前弹出提示。 并且, 拨打完以后会回到原来的应用。[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNumber];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
}
三。利用openURL(telprompt)
特点: 拨打前弹出提示。 并且, 拨打完以后会回到原来的应用。注意: Apple的官方文档中, 没有出现过telprompt, 之前也有人使用这个, 上传审核的时候被拒绝了。
[cpp] view
plaincopy
//拨打电话
- (void)callPhone:(NSString *)phoneNumber
{
//phoneNumber = "18369......"
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
相关文章推荐
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- 如何在iOS应用中拨打电话,并让用户确认
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS开发:应用内拨打电话结束后返回
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS 程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS拨打电话并且能返回当前应用的方法
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- 转 iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
- iOS应用系统获取qq和拨打电话
- iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,AppStore,拨打电话)