ipa如何通過網絡進行安裝


  蘋果手機端應用,如果發布的到Appstore上,往往比較復雜,周期也比較長,Over-the-Air是Apple在 iOS4 中新加的一項技術,目的是讓開發者能夠脫離Appstore,實現從自己的服務器下載並安裝iOS應用。簡單地說,就是用戶只需要在Safari中點開一條鏈接,就能直接在主界面中安裝App。

  在高版本的IOS上,plist必須要部署到https服務器上,才能正常訪問。下面用示例來介紹如何脫離AppStore來安裝IPA應用。

1 xcode打包ipa(app.ipa)

並上傳到可以公網訪問網絡上,例如 http://yourwebsite.com/ipa/app.ipa可以訪問,如果是IIS服務器,那么需要配置mime類型支持.ipa下載,否則會提示錯誤。

  1. 打開IIS服務管理器,找到服務器,右鍵-屬性,打開IIS服務屬性;
  2. 單擊MIME類型下的“MIME類型”按鈕,打開MIME類型設置窗口;
  3. 單擊“新建”,建立新的MIME類型;

    擴展名是:.apk MIMI類型是:application/vnd.android.package-archive

    擴展名是:.ipa MIMI類型是:application/iphone

配置好后,IIS重啟。配置成功再次訪問網址,會提示下載:

2 編寫plist文件

<?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://yourwebsite.com/ipa/app.ipa</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.aruistar.cmcapp</string>
                <key>bundle-version</key>
                <string>1.0</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>cmcapp</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

plist文件必須放到https服務上,自己沒有架設,可以上傳到github上進行處理。plist中注意<string>http://yourwebsite.com/ipa/app.ipa</string>的配置。

2 創建一個ipainstall.html的頁面,代碼如下:

 1 <!DOCTYPE html>
 2 <html >
 3 <head>
 4     <title>ipa installed on the air</title>
 5     <meta charset="UTF-8">
 6     <style type="text/css">
 7     body{
 8         padding: 0;
 9         margin: 0;
10 
11     }
12     table
13     {
14         width: 100%;
15         border: solid 1px #999;
16         border-collapse:collapse;
17     }
18     table tr,table td
19     {
20         
21         border: solid 1px #999;
22         border-collapse:collapse;
23     }
24 </style>
25 </head>
26 <body>
27     <div style="font-size:70px; text-align:center; background-color:#999;height:160px;line-height:160px;">
28      無線安裝iOS應用
29     </div>
30     <div style="font-size:60px; text-align:center;">
31     <table>
32     <tr>
33     <td>序號</td>
34     <td>應用名稱</td>
35     <td>備注</td>
36     </tr>
37      <tr>
38     <td>1</td>
39     <td><a  href="itms-services://?action=download-manifest&url=https://raw.githubusercontent.com/yourgithub/iosapp/master/manifest.plist">內部市場化</a></td>
40     <td>IOS</td>
41     </tr>
42     <table>
43     </div>
44 </body>
45 </html>

這里注意的是,itms-services://?action=download-manifest&url不是默認的github上的網址,必須是原始文件的地址,一般是raw.githubusercontent.com開頭的。

這個網址,必須用蘋果safari進行訪問才能解析:

 

安裝成功后,打開app即可操作了:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM