打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
iOS 内置URL schemes简介(2)

(3)Text links(文本链接)

使用sms协议来加载Messages应用。该URL的正式格式为"sms:<phone>",其中<phone>是可选的,用来指定sms消息接收者的号码。参数值包含了数字,"+" , "-" , "." 。 
           HTML页面中

  1. <a href="sms:">Launch Messages App</a> 
  2. <a href="sms:1-408-555-1212">New SMS Message</a> 

本地应用中

  1. if(![[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"sms:1-408-555-1212"]] ){ 
  2. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"无法打开程序" delegate:nil cancelButtonTitle:@"确认" otherButtonTitles: nil] ; 
  3. [alert show] ; 

(4)iTunes links(iTunes链接)

iTunes链接用来链接到iTunes Store中的内容。通过Apple的 iTunes Link Maker我们可以方便的查询并获取应用程序的链接地址。 
            HTML页面中

  1. <a href="https://itunes.apple.com/cn/app/numbers/id361304891?mt=8">Numbers</a> 

本地应用中

  1. [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://maps.apple.com/?q=cupertino"]] ; 

正确的地图链接格式规则如下

域名必须为maps.apple.com

路径不能为/maps/*

参数不能为q=*

参数不能包含view=text或dirflag=r

(5)Youtube links(Youtube链接)

Youtube链接用来加载YouTube应用程序或者链接值YouTube的web站点来播放指定的视频。链接到Youtube的应用可以播放其视频。链接是以http为开头的,而非youtube。 
              HTML页面中

  1. <a href="http://www.youtube.com/watch?v=xNsGNlDb6xY">iPhone5</a> 
  2. <a href="http://www.youtube.com/v/xNsGNlDb6xY">iPhone5</a> 

本地应用程序中

  1. //或 http://www.youtube.com/v/xNsGNlDb6xY 
  2. if(![[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=xNsGNlDb6xY"]] ){ 
  3. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"无法打开程序" delegate:nil cancelButtonTitle:@"确认" otherButtonTitles: nil] ; 
  4. [alert show] ; 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
iOS提交应用至App Store流程
iOS开发 判断当前APP版本和升级
iOS程序中调用系统自带应用(短信,邮件,浏览器,地图,appstore,拨打电话)
关于 iPhone、iPad 和 iPod touch 的备份
iphone 保存图片到相册照片库
用啥看VR视频?12款VR播放器推荐| 实用攻略
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服