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] ; 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值