苹果App的ipa下载需要有几个前提,可参考:Android和IOS的本地App如何安装(apk&ipa)

本文主要介绍如何部署https提供ipa的下载,步骤如下:

 

1. 搭建一个HTTPS服务,可以使用HTTPD或者Tomcat构建,具体可搜索相关帖子。由于https好用的证书(就是浏览器默认支持)需要付费,这里巧用github.com可以实现部署,可以参考坛友kiko 的帖子

2. 编写plist文件。plist文件中需注意提供正确的ipa文件路径,以及版本号和Bundle ID。模版: 点我下载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<? xml version = "1.0" encoding = "UTF-8" ?>
<! DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
< 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 >
      <!-- http或者https链接的ipa文件地址 -->
      < string >http://x5.justep.com/apps/x5.ipa</ string >
     </ dict >
     < dict >
      < key >kind</ key >
      < string >full-size-image</ string >
      < key >needs-shine</ key >
      < true />
      < key >url</ key >
      <!-- http或者https链接的图片地址,可直接使用app对应的icon(分辨率没强制要求) -->
      < string >http://x5.justep.com/apps/x5.png</ string >
     </ dict >
     < dict >
      < key >kind</ key >
      < string >display-image</ string >
      < key >needs-shine</ key >
      < true />
      < key >url</ key >
      <!-- http或者https链接的小图片地址,可直接使用app对应的icon(分辨率没强制要求) -->
      < string >http://x5.justep.com/apps/x5.png</ string >
     </ dict >
    </ array >
    < key >metadata</ key >
    < dict >
     < key >bundle-identifier</ key >
     <!-- BundleID,就是新建app时的包名 -->
     < string >com.justep.x5.demo</ string >
     < key >bundle-version</ key >
     <!-- 版本号 -->
     < string >5.3.2</ string >
     < key >kind</ key >
     < string >software</ string >
     < key >title</ key >
     <!-- 安装app时的提示信息 -->
     < string >X5 App download</ string >
    </ dict >
   </ dict >
  </ array >
</ dict >
</ plist >

3. 将plist文件放在https服务目录下。这样就有一个有效的连接地址指向这个文件,例如:

手机如果要安装app,可以在safari浏览器输入:

1
itms-services:///?action=download-manifest&url=https://xxx/.../myapp.plist

注意:是三个/,不是笔误,url后面写的就是一个有效的可访问plist的https地址,一定要https,否则无法打开
当然,你可以做一个页面,里面用一个链接指向这个地址,方便下载,例如:

1
< a onclick = "window.location.href='itms-services:///?action=download-manifest&url=https://xxx/.../myapp.plist'" >下载IPA</ a >