美文网首页
iOS企业版发布和配置iVersion自动更新检测

iOS企业版发布和配置iVersion自动更新检测

作者: geekMole | 来源:发表于2017-12-09 18:53 被阅读150次

1.发布

(1)证书配置

苹果企业开发账号的发布证书配置和其他开发账号并没太多区别,只是不需要苹果审核而且打包的程序不能发布到App Store上, 最终的区别是在发布流程上面企业证书配置参考

(2)打包发布

打包发布选enterprise, 选择正确的证书和pp文件即可打包.首次打包发布可在导出文件前勾选生成manifest.plist;
manifest.plist文件是配置ipa包下载路径, app安装时进度图片url的文件, 最终发布后的安装入口指向此文件即可.具体路径如何配置,在打包时候生成此文件时候按照提示填写,后续修改相应路径即可;
manifest.plist文件为入口文件,并且必须放置在https协议的服务器路径下才可以引导安装app, 所以安装页面最好做成一个html页面, 在页面里面创建安装链接指向manifest.plist文件, 这样的话后续manifest.plist如果更改名字, 只用在安装页面重新配置以下安装链接路径即可, html的url可以做成固定的二维码;
以下是我自己写的一个APP安装的html页面供分享:

<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />
<title>
iOS版-MyAPP安装
</title>

<style type="text/css">
    .title{
        background: #fdfdfd;
        height: 90px;
        font-size: 30px;
        padding: 20px;
        border-bottom: 3px solid #dddddd;
        box-shadow: 0 2px 0 #dddddd;
    }
    .title span{
        color: #666666;
        margin-left: 5px;
        margin-right: 5px;
        margin-top: auto;
        margin-bottom: auto;
    }
    .installBody{
        text-align: center;
        margin-top: 150px;
        font-size: 3rem;
    }
    img.icon{
        margin-top:auto;
        margin-bottom: auto;
        height: 200px;
        width: 200px;
        border:2px solid #dddddd;
        border-radius: 20px;
        padding:20px;
    }
    .tip{
        margin-bottom: 10px;
        font-size: 24px;
    }
    .action{
        display:inline-block;
        width:220px;
        height:60px;
        margin:20px auto 20px auto; 
        padding:5px;
        background:#00bc9e; 
        color:#ffffff;
        font-size:30px;
        text-decoration:none;
        text-align: center;
    }
</style>

<script>
    function load()
    {
        function myBrowser(){
            var userAgent = navigator.userAgent;
            var isOpera = userAgent.indexOf("Opera") > -1;
            if (isOpera) {
                return "Opera"
            }; 
            if (userAgent.indexOf("Firefox") > -1) {
                return "FF";
            } 
            if (userAgent.indexOf("Chrome") > -1){
          return "Chrome";
         }
            if (userAgent.indexOf("Safari") > -1) {
                return "Safari";
            } 
            if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
                return "IE";
            }; 
        }
        var mb = myBrowser();
        if ("Safari" == mb) {
            document.getElementById("warning").visibility == "hidden";
        }
    }
</script>
</head>
<body onload="load()">
    <div class="title"><span style="margin-left:40px; font-size: 40px;">MyAPP</span><span style="margin-left: 50px;">版本:1.0.0(build 10)</span><span>/</span><span>大小:2.4MB</span><span>/</span><span>2017-12-08</span></div>
    <div class="installBody">
        <div><img class="icon" src="https://www.xxxxx.com/xxxxx/icon.512x512.png"></div>
        <a class="action" href="itms-services:///?action=download-manifest&url=https://www.xxxxx.com/xxxxx/myapp_ios_release.plist">点击安装</a>
        <div class="tip"><span style="display: inline-block;background: #4fbbd4;border:1px solid #dddddd; border-radius: 5px;">适用于iOS设备</span><span style="display: inline-block;background: #d94f50;border:1px solid #dddddd; border-radius: 5px;">正式版</span></div>
        <p style="font-size: 24px;">
            <span id="warning">若无法安装请点击右上角,选择Safari打开此页面。</span><br/>
            <br/>
            点击安装后,回到桌面查看安装进度。
            <br/>
            <span style="color: red;">首次安装需做以下操作:
            <br/>
        打开手机设置-->通用-->描述文件与设备管理-->在企业应用栏下点击BGI Tech做信任授权
            </span>
        </p>
    </div>
</body>
</html>

2.配置iVersion框架自动更新提示

集成iVersion框架可以使用cocopods, 具体iVersion的接口说明可以gitHub上查看
iVersion 配置企业版升级提醒的关键是需要自己创建一个版本说明文件,记录版本更新历史,配置iVersion在app每次启动时候获取版本说明文件,然后对比最新版本号和本地版本号做版本检测
所以需要在APP启动的时候配置iVersion,根据接口说明在APPdelegate类重写initialize方法即可

+(void)initialize{
    iVersion *iv = [iVersion sharedInstance];
    iv.updateURL = [NSURL URLWithString:@"itms-services:///?action=download-manifest&url=https://www.xxxxx.com/xxxxx/myapp_ios_release.plist"];
    iv.remoteVersionsPlistURL = @"https://www.xxxxx.com/xxxxx/myapp_ios_release_versions.plist";
    iv.useAppStoreDetailsIfNoPlistEntryFound = NO;
}

版本说明文件myapp_ios_release_versions.plist如下新版本发布增加新的key和string说明标签即可:

<?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>1.0.0</key>
    <string>First release</string>
    <key>1.1.0</key>
    <string>NEW: fixed bugs</string>
</dict>
</plist>

相关文章

网友评论

      本文标题:iOS企业版发布和配置iVersion自动更新检测

      本文链接:https://www.haomeiwen.com/subject/farpixtx.html