蘋果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瀏覽器輸入:

注意:是三個/,不是筆誤,url后面寫的就是一個有效的可訪問plist的https地址,一定要https,否則無法打開
當然,你可以做一個頁面,里面用一個鏈接指向這個地址,方便下載,例如:

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