ipa下载安装所需的plist文件

链接:https://www.jianshu.com/p/dc4ac0941edc

要发布还必须有一个plist文件,在Xcode6之前会自动生成一个plist文件,但是Xcode6之后需要我们自己创建plist,文章最后提供一个plist模板,复制并重命名为plist后打开根据提示操作即可.图18为plist的截图,可以看到有三个URL,分别存放ipa,大小图标。下图的1(ipa)、2(大图)、3(小图)填写我们自己生成的URL,即将ipa和大小图标放在我们自己的服务器,当用Safari打开plist时会根据填的plist里面的1、2、3对应的URL来下载安装ipa、大小图标。

image.png

下面是plist模板的文本形式,将其复制到文本然后重命名.plist,用Xcode打开按照提示编辑即可。

<?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>
                    <string>ipa包URL(必填)</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>full-size-image</string>
                    <key>needs-shine</key>
                    <false/>
                    <key>url</key>
                    <string>下载时大图(非必填)</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>display-image</string>
                    <key>needs-shine</key>
                    <false/>
                    <key>url</key>
                    <string>下载时小图(非必填)</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>BundleID(必填)</string>
                <key>bundle-version</key>
                <string>1.0</string>
                <key>kind</key>
                <string>software</string>
                <key>subtitle</key>
                <string>副标题(非必填)</string>
                <key>title</key>
                <string>应用名(必填)</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

,Plist是一种文件形式,通常用于储存用户设置,也可以用于存储捆绑的信息,该功能在旧式的Mac OS中是由资源分支提供的。由于Plist中存储的数据是抽象的,其采用的文件格式可以不止一种。
2,它是IOS开发过程中常用来捆绑信息的一种文件格式,它是数据格式是xml

补充: ipa文件
IPA是Apple程序应用文件iPhoneApplication的缩写,ipa格式就是IOS系统安装包的链
.plist下载地址格式:
<a href="itms-services://?action=download-manifest&url=https://www.baidu.com/ios/ceshi.plist"></a>

举个例子:

在此安装包暂命名为:Mytest.ipa

1.编写安装配置文件(Mytest.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>
                    <!-- 需要安装的ipa包在服务器的路径 -->
                    <string>https://www.example.cn/ipa/mytest/Mytest.ipa</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>full-size-image</string>
                    <key>needs-shine</key>
                    <true/>
                    <key>url</key>
                    <!-- 安装时需要显示的大图标(1024*1024)在服务器的路径 -->
                    <string>https://www.example.cn/ipa/mytest/icon_full_size_s.png</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>display-image</string>
                    <key>needs-shine</key>
                    <true/>
                    <key>url</key>
                    <!-- 安装时需要显示的小图标(180*180)在服务器的路径 -->
                    <string>https://www.example.cn/ipa/mytest/icon_display_s.png</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.mcrazy.Mytest</string>
                <key>bundle-version</key>
                <string>1.1.4</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>测试客户端</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

2.上传配置文件(Mytest.plist)至服务器

用nginx或tomcat提供外部访问,下面在前端安装网页上就要用到此外部访问url: https://www.example.cn/ipa/mytest/Mytest.plist
3.制作前端访问H5网页,触发安装事件

H5网页:Mytest.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>  
    <meta charset="UTF-8">
    <title>Ad Hoc .ipa在线安装</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }

        .download_div{
            width: 100%;
            height: 100%;
            text-align: center;
            font-weight: bold;
            /*background: -webkit-gradient(linear,0 0,0 bottom,from(#dbeae0),to(hsla(0,0%,100%,.6)));*/
            font-size: 2em;
        }

        .download_title{
            padding-top: 1em;
            padding-bottom: 1em;
            /*background-color: #d7e2f7;*/
            background: -webkit-gradient(linear, left top, left bottom, from(#d7e2f7), to(#ffffff));
        }
        .img_app_overview {
            width: 100%; 
            height: 480px; 
            display: block;
        }

        .download_button{
            /*margin-top: -0.3em;*/
            background: -webkit-gradient(linear,left top,left bottom,from(#879ee3), to(#ffffff));
            width: 100%;
        }

        .button{
            /*margin-top: 5em;*/
            margin-left: 0.8em;
            display: inline-block;
            outline: none;
            cursor: pointer;
            text-align: center;
            text-decoration: none;
            font: 14px/100% Arial, Helvetica, sans-serif;
            padding: .5em 2em .55em;
            text-shadow: 0 1px 1px rgba(0,0,0,.3);
            -webkit-border-radius: .5em; 
            -moz-border-radius: .5em;
            border-radius: .5em;
            -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
            -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
            box-shadow: 0 1px 2px rgba(0,0,0,.2);
            color:#fff;
        }

        .button_green{
            background: #c8dd95;
            background: -webkit-gradient(linear, left top, left bottom, from(#7a71d0), to(#ffffff) );
            background: -moz-linear-gradient(-90deg, #7a71d0, #ffffff);
        }

        .download_tips{
            font-size: 0.5em;
            margin-top: 1em;
            font-weight: normal;
            margin-top: 3em;
        }

        .button_top{
            margin-top: 3em;
        }

        a:hover, a:visited, a:link, a:active {
            text-decoration: none;
            color: #fff;
        }

        /*mobile*/
        @media screen and (max-width: 1199px){
            .img_app_overview {
                width: 100%; 
                height: 250px; 
                display: block;
            }
        }
    </style>
</head>
<body>
    <div class="download_div">
        <p class="download_title">测试安装包v1.1.4</p>
        <img class="img_app_overview" src="img_app_overview.png" alt="Mr.chao">
        <div class="download_button">
            <button class="button button_green button_top" onclick="downloadClientApp();"><a href="javascript:void(0);">点击安装app</a></button>
            <!-- <button class="button button_green button_top"><a href="{{androidAUrl}}">Android客户端下载</a></button> -->
            <div class="download_tips">
                <strong>微信扫描</strong>下载,<strong>请点击右上角</strong>,<br />选择“<strong>在浏览器中打开</strong>”即可安装下载
            </div>
        </div>
    </div>
    <script>
        var downloadClientApp = function() {
            // 在此用到配置文件(Mytest.plist)的外部链接
            window.location.href='itms-services:///?action=download-manifest&url=https://www.example.cn/ipa/mytest/Mytest.plist';
        }
    </script>
</body>
</html>

更简单的html:

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>bitspot App下载</title>
</head>
<body>
<a href="itms-services://?action=download-manifest&url=https://www.example.cn/ipa/mytest/Mytest.plist">点击安装</a>
</body>
</html>

4.安装

将H5网页部署在服务器上,需要有能Https访问证书

手机浏览器访问H5安装界面

image.png

点击安装

ending…

OTA

PS:如果不想买域名,需要搭建这样一个安装环境。可以借助GitHub平台实现。只要要把上述的配置文件、资源文件、界面等托管在GitHub上的仓库里边,这样每个资源文件就能得到一个github的域名+https证书的url路径。免费受欢迎。

OTA 即 Over-the-Air,是 Apple 在 iOS4 中新加的一项技术,目的是让开发者能够脱离 Appstore,实现从服务器下载并安装 iOS 应用。
用户只需要在 iOS 设备的浏览器中,打开 itms-services:// 协议链接,就可以直接安装App。(注意:此处的安装是指,个人账号需要注册设备,企业账号无需注册设备)

OTA方式安装,是通过 WebKit 解析链接中的 itms-services:// 来实现的,itms-services:///?action=download-manifest&url='plist文件地址(可以在网页上直接显示plist内容)'

原文链接:https://blog.csdn.net/u010277446/article/details/87914472

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。