分享

iOS 内置URL schemes简介(2)

 ccccshq 2014-04-09

(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./watch?v=xNsGNlDb6xY">iPhone5</a> 
  2. <a href="http://www./v/xNsGNlDb6xY">iPhone5</a> 

本地应用程序中

  1. //或 http://www./v/xNsGNlDb6xY 
  2. if(![[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://www./watch?v=xNsGNlDb6xY"]] ){ 
  3. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"无法打开程序" delegate:nil cancelButtonTitle:@"确认" otherButtonTitles: nil] ; 
  4. [alert show] ; 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多