参考文档:
- https://www.jianshu.com/p/e85f859b555a
- https://www.jianshu.com/p/2f5ec1ab46f4
- https://blog.csdn.net/linxinfa/article/details/88540213
- https://blog.csdn.net/Drunkard_001/article/details/103275114
1. 前言
我们打出的ipa包,有两种主要的方式投放到市场上:
- 一个是上架AppStore,
- 一个是放到自己的http/https服务器上,通过自己的网页下载。
上架AppStore可能会遇到一些限制,审核严格,过程坎坷,这里主要介绍如何放到自己的http服务器上以供外部玩家进行下载安装ipa。
注意,必须使用企业证书打的ipa包 或者”AH-hoc 打的包“才可以通过自己的http/https服务器下载安装。
2. 准备的资料
- 一张57 * 57 的Icon
- 一张 512 * 512 的Icon
- 一个IPA包(用企业证书或者Ad_Hoc证书打出来的包)
- 一个https 的服务器
3. 流程
- 将57 * 57 的图标 和 512 * 512 的图标放到服务器上,并返回对应的地址,例如:
- https://cloudvideo.copperflow.cn/icon-57.png
- https://cloudvideo.copperflow.cn/icon-512.png
- 将IPA 放到服务器上,并返回对应的地址,例如:
https://cloudvideo.copperflow.cn/smartlord.ipa
- 创建mainfest
参考下面的plist示例, 可以用vsCode新建一个文件,把代码复制上去。
这个文件是苹果用于解析下载用的。非常重要
<?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的链接地址(https://XXX.ipa)</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<false/>
<key>url</key>
<string>(512 * 512 的图片地址(https://xxxx.png)</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<false/>
<key>url</key>
<string>57 * 57 的图片地址(https://xxxx.png)</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>你app的bundleId</string>
<key>bundle-version</key>
<string>你的版本号</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>你app的标题</string>
</dict>
</dict>
</array>
</dict>
</plist>
- 将这个mainfest.plist文件 放到服务器上,并返回一个链接地址,例如:
https://cloudvideo.copperflow.cn/manifest.plist
4. 访问mainfest.plist 文件并下载的两种方式
4.1 直接拼接地址访问
- 链接的拼接格式如下:
itms-services://?action=download-manifest&url=https://xxxx/manifest.plist
- 注意: url 中的地址,需要替换成你mainfest 在服务器中的地址。
- 然后,将整个
itms-services://?action=download-manifest&url=https://xxxx/manifest.plist
链接,放到苹果手机的默认浏览器访问,就可以提示下载。
4.2 添加一个html引导下载页面
这个页面只是方便操作,页面功能可以很简单,就一个下载按钮,点击下载后,开始下载。
然后将这个页面,放到服务器上,通过链接访问。
注意: 必须用手机系统自带的浏览器,才能下载。
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>你app的名称</title>
</head>
<body>
<div class="container">
<h1>你app的名称</h3>
<h3 class="h5Styple">请复制链接到系统的浏览器打开</h5>
<img
src="https://cloudvideo.copperflow.cn/icon-512.png" // 为了美观,放了一张图片
width="40%"
height="40%"
/>
<a
class="buttonStyle"
href="itms-services://?action=download-manifest&url=https://cloudvideo.copperflow.cn/manifest.plist"
>点击下载安装</a
>
</div>
</body>
<style>
.container {
display: flex; /* 使用 Flex 布局 */
flex-direction: column; /* 将子元素垂直排列 */
justify-content: center; /* 在容器内垂直居中元素 */
align-items: center; /* 在容器内水平居中元素 */
min-height: 100vh; /* 设置容器高度为视口高度 */
margin-top: -50px;
}
.buttonStyle {
width: 40%;
height: 85px;
background: rgb(233, 163, 59);
font-size: 25px;
border-radius: 5px;
border-width: 0px;
color: white;
text-align: center;
align-items: center;
margin-top: 30px;
line-height: 85px;
text-decoration: none;
}
.h5Styple {
color: red;
}
</style>
</html>