苹果分发IPA机制

xiaoxiao2021-02-28  130

前言

公司做自动化版本管理,弄完了Jenkins,又想不用fir.im了,公司自己完成这个分发的功能。目前已经实现了,还有一些细节需要优化。

一、安装包的存储工具minio

1、Homebrew

首先安装Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、安装mino

使用 Homebrew安装minio

brew install minio/stable/minio minio server /data

注:不知道是不是墙的原因,第一条命令之前的操作一直失败,最好能在可以翻墙的环境使用。我使用的是Lantern翻墙。

二、配置iOS下载需要的文件

1、需要的文件
应用(.ipa)文件清单(.plist)文件
2、应用文件

可以通过Jenkins自动化打包来自动上传到存储位置。 请参考文章:https://blog.csdn.net/tianxiawoyougood/article/details/56012206

3、清单文件
<?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>http://domain/app.ipa</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>needs-shine</key> <true/> <key>url</key> <string>http://domain/logo/logo.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>com.apple.123</string> <key>bundle-version</key> <string>1.0.0</string> <key>kind</key> <string>software</string> <key>subtitle</key> <string>副标题</string> <key>title</key> <string>标题</string> </dict> </dict> </array> </dict> </plist>

可以参考链接:http://help.apple.com/deployment/ios/#/apda0e3426d7

清单文件中有三个需要注意的地方: 1、两个 url 地址,即 software-package 和 display-image 的 URL,前者是所要安装的 ipa 地址,后者是安装时桌面显示的 logo 图标。 2、metadata里需要修改 bundle-identifier 和 bundle-version,具体是什么就不用介绍了,但是要注意一定要跟所安装的 ipa 包内容一致,不然无法安装成功。 3、可以修改title和subtitle,定制安装时弹出框的内容。

三、web网页调用方法安装APP

1、点击安装

在网页中加入如下的链接:

<a href="itms-services://?action=download-manifest&url=http://domain/manifest.plist">下载App</a>
2、通过JavaScript自动下载
<script> var url = "http://domain/manifest.plist"; window.location = "itms-services://?action=download-manifest&url=" + url; </script>

备注:此代码放到 html 标签的 head 标记中,这样就会自动提示下载和安装了。

参考:

http://stephen830.iteye.com/blog/2101884 http://help.apple.com/deployment/ios/#/apda0e3426d7

转载请注明原文地址: https://www.6miu.com/read-72498.html

最新回复(0)