博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS 拨打电话相关知识总结
阅读量:4071 次
发布时间:2019-05-25

本文共 2262 字,大约阅读时间需要 7 分钟。

示例方法

1.貌似是私有方法,拨打电话完成后可返回应用,拨打前有提示。

NSString *strTel= [NSString stringWithFormat:@"telprompt:13888888888"];

  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:strTel]];

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.( 
“YouTube Links” describes the format for linking to YouTube videos.()
“iTunes Links” describes the format for linking to items in the iTunes Music Store.()

 

转一下别人写的:

在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,请查看相关博文)

            UIDevice *device = [UIDevice currentDevice];

            NSString *strModel = [device model];

            if ([strModel hasPrefix:@"iPhone"]) {

                NSString *strTel= [NSString stringWithFormat:@"tel:%@", kServiceTel];

                if (_wvTel == nil)

                    _wvTel = [[UIWebView alloc] initWithFrame:CGRectZero];

                            [_wvTel loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:strTel]]];

            } else {

                            [[SQAlertView defaultAlert] alert:[NSString localizedString:@"AlertTitle_Default"]

                                        message:[NSString localizedString:@"AlertTitle_NotSupport"]];

            }

转载地址:http://lneji.baihongyu.com/

你可能感兴趣的文章
linux下的mysql源码安装
查看>>
plsql连接oracle出现ORA-12154: TNS: 无法解析指定的连接标识符
查看>>
oracle 查看库中每个表所占的空间大小
查看>>
流复制中的问题max_connection
查看>>
在mysql中使用模糊查询时,使用中文查询结果不正确问题
查看>>
redhat7修改系统语言
查看>>
启动rabbitmq:ERROR: distribution port 25672 in use on localhost (by non-Erlang process?)
查看>>
Linux下mysql8.0用rpm安装
查看>>
linux下mysql 8.0忘记密码后重置密码
查看>>
mysql学习笔记(一)
查看>>
mysql学习笔记(二)
查看>>
mysql学习笔记(三)
查看>>
mysql学习笔记(四)
查看>>
mysql学习笔记(五)
查看>>
mysql学习笔记(六)
查看>>
iOS 微信SDK1.8.6后需要UniversalLink解决方案及采坑记录
查看>>
iOS 异形tabBar, 中间item凸起
查看>>
swift中单例的创建及销毁
查看>>
Swift中NSRange和Range的转换
查看>>
获取App Store中App的ipa包
查看>>