本文共 2262 字,大约阅读时间需要 7 分钟。
示例方法
1.貌似是私有方法,拨打电话完成后可返回应用,拨打前有提示。
NSString *strTel= [NSString stringWithFormat:@"telprompt:13888888888"];
2.用网页加载来拨打电话,效果和第一种一样,使用没有任何问题
NSURL * url = [NSURL URLWithString:@"tel:11111111"];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
3.普通方法,直接拨打,打完回不到应用,回到系统拨号界面
NSString *strTel= [NSString stringWithFormat:@"tel:13888888888"];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:strTel]];
相关问题:
1.特殊号码拨打失败
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://*111*12371#]];
相关库 CoreTelephony
这个里面有一个Demo(CoreTelephonyDemo:)
所有相关链接:
Organization of This Document
Each article in this document describes the format of a particular type of URL:
“Mail Links” describes the format for sending email with the Mail application.(mailto:frank@wwdcdemo.example.com)
“Phone Links” describes the format for dialing phone numbers in the Phone application.(tel:1-408-555-5555) “Text Links” describes the format for launching the Text application.(sms:
sms:1-408-555-1212)
“Map Links” describes the format for specifying locations in the Maps application.(
转一下别人写的:
在iPhone中,可以直接用UIApp打开URL地址。如下所示:
[ UIApp openURL: [ NSURL URLWithString:@" ] ];
或者:[ UIApp openURL: [ NSURL URLWithString:@"mailto:apple@mac.com?Subject=hello" ] ];
与此同时,iPhone还包含一些其他除了http://或者mailto:之外的URL:
sms:// 可以调用短信程序
tel:// 可以拨打电话
itms:// 可以打开MobileStore.app
audio-player-event:// 可以打开iPod
audio-player-event://?uicmd=show-purchased-playlist 可以打开iPod播放列表
video-player-event:// 可以打开iPod中的视频
个人项目中使用实例:(使用了SQLibs,请查看相关博文)
转载地址:http://lneji.baihongyu.com/