利用plist实现越狱机器直接安装iOS APP

       虽然苹果公司优化过了APP Store,适当加快了APP下载的速度,但是对于中国网民来说,到Apple APP Store中安装或更新APP,都是一件非常痛苦的事情----太慢了!

今天小研究了一下,发现在已越狱的iOS设备上,或者是大企业账户的ipa,可以直接通过下载plist的方式,直接安装或更新你的APP。

从前端使用上来讲,最简单来说,就一行代码:

< a  id = "btnInstallApp"  href = "itms-services://?action=download-manifest&url=http://www.ooxxox.com/static/CloudAlbum.plist" >
     点击直接安装百度云相册APP
</ a >

当然,通过<a>标签直接打开这么一个协议的地址一般情况下不会有什么问题,但为了不影响页面的正常展示,可以巧妙的使用<iframe>来打开这个链接,因此,再加上下面这一段儿代码即可:

<script>
     ( function () {
         var  btnInstallApp = document.getElementById( 'btnInstallApp' );
         btnInstallApp.onclick =  function () {
             var  r = document.createElement( 'iframe' );
             r.src =  this .href;
             r.style.display =  "none" ;
             document.body.appendChild(r);
             return  false ;
         }
     })();
</script>

如果你做的是一张二维码,想实现扫描二维码后,不做任何操作即可直接安装APP,那么只需要默认触发一下<a>标签的click事件即可,在上面的代码基础上加上:

// 直接安装
btnInstallApp.click();

上面的是结果,下面我们来说前提条件:你得先准备一份儿plist文件,基本格式如下:

<? xml  version = "1.0"  encoding = "UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
< plist  version = "1.0" >
< dict >
    < key >items</ key >
    < array >
        < dict >
            < key >assets</ key >
            < array >
                < dict >
                    < key >kind</ key >
                    < string >software-package</ string >
                    < key >url</ key >
                    <!-- 你的APP下载地址 -->
                    < string >http://www.ooxxox.com/static/CloudAlbum_1_0_0_tongbu.ipa</ string >
                </ dict >
                < dict >
                    < key >kind</ key >
                    < string >display-image</ string >
                    < key >needs-shine</ key >
                    < true />
                    < key >url</ key >
                    <!-- 你的APP下载过程中,展示的icon -->
                    < string >http://www.ooxxox.com/static/album.png</ string >
                </ dict >
            </ array >< key >metadata</ key >
            < dict >
                < key >bundle-identifier</ key >
                <!-- 你的APP对应的bundle -->
                < string >com.baidu.album</ string >
                < key >bundle-version</ key >
                <!-- 你的APP版本号 -->
                < string >1.0.0</ string >
                < key >kind</ key >
                < string >software</ string >
                < key >subtitle</ key >
                <!-- 你的APP名称 -->
                < string >云相册</ string >
                < key >title</ key >
                <!-- 你的APP在下载之前会弹出一个confirm层,让你确认 -->
                < string >百度云相册1.0版本(需越狱哦,亲)</ string >
            </ dict >
        </ dict >
    </ array >
</ dict >
</ plist >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值