iOS——由app跳转到AppStore下载app或者调转到某一个网页

找到应用程序的描述链接,比如:http://itunes.apple.com/gb/app/yi-dong-cai-bian/id391945719?mt=8

然后将 http:// 替换为 itms:// 或者 itms-apps://:

然后打开这个链接地址:
<code style="margin: 0px; padding: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">[[</span><span class="typ" style="color: rgb(43, 145, 175); margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">UIApplication</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;"> sharedApplication</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">]</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;"> openURL</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">:[</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">NSURL </span><span class="typ" style="color: rgb(43, 145, 175); margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">URLWithString</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">:@</span><span class="str" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">"<span style="font-family: Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); margin: 0px; padding: 0px; line-height: normal; white-space: normal;">itms://</span><a target=_blank target="_blank" href="http://itunes.apple.com/gb/app/yi-dong-cai-bian/id391945719?mt=8" style="color: rgb(59, 89, 153); text-decoration: none; margin: 0px; padding: 0px; font-family: Helvetica, Arial, sans-serif; line-height: normal; white-space: normal;">itunes.apple.com/gb/app/yi-dong-cai-bian/id391945719?mt=8</a>"</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">]];</span></code>
<code style="margin: 0px; padding: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">
</code><pre class="default prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; margin-top: 0px; margin-bottom: 10px; padding: 5px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width: auto; max-height: 600px;"><code style="margin: 0px; padding: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">[[</span><span class="typ" style="color: rgb(43, 145, 175); margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">UIApplication</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;"> sharedApplication</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">]</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;"> openURL</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">:[</span><span class="pln" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">NSURL </span><span class="typ" style="color: rgb(43, 145, 175); margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">URLWithString</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">:@</span><span class="str" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">"<span style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; color: rgb(0, 0, 0); margin: 0px; padding: 0px; white-space: normal; background-color: rgb(255, 255, 255);">itms-apps</span><span style="font-family: Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); margin: 0px; padding: 0px; line-height: normal; white-space: normal;"> ://</span><a target=_blank target="_blank" href="http://itunes.apple.com/gb/app/yi-dong-cai-bian/id391945719?mt=8" style="color: rgb(59, 89, 153); text-decoration: none; margin: 0px; padding: 0px; font-family: Helvetica, Arial, sans-serif; line-height: normal; white-space: normal;">itunes.apple.com/gb/app/yi-dong-cai-bian/id391945719?mt=8</a>"</span><span class="pun" style="margin: 0px; padding: 0px; vertical-align: baseline; background-color: transparent;">]];

这个最好在真机上面测试,在模拟器上测试,会没有效果。</span></code>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值