不通過AppStore,在iOS裝置上直接安裝應用程式的原理

來源:互聯網
上載者:User

標籤:

本文轉載至  http://mobile.51cto.com/hot-439095.htm

通過itms-services協議,可以通過safari瀏覽器直接在iOS裝置上安裝應用程式。利用這種方式,只要在內網布置一個伺服器,測試人員只需要通過測試裝置的safari瀏覽器訪問特定的url既可以實現安裝,然後測試了。

AD:WOT2015 互連網營運與開發人員大會 熱銷搶票

 

通過itms-services協議,可以通過safari瀏覽器直接在iOS裝置上安裝應用程式。利用這種方式,只要在內網布置一個伺服器,測試人員只需要通過測試裝置的safari瀏覽器訪問特定的url既可以實現安裝,然後測試了。(PS:越獄裝置也可以)

itms- services協議需要一個plist設定檔。如果要實現上面圖示的功能,需要的檔案有:一個ipa檔案,一個plist檔案,一個html檔案和一 個圖片檔案。其中,最主要的,就是plist檔案。通過shell指令碼,我們可以讓其自動為我們產生plist檔案和html檔案,並且在xcode工程 中的ipa檔案和程式表徵圖檔案複製一份,放到一起。

《xcode自動打ipa包指令碼》學習地址:http://webfrogs.me/2012/09/19/buildipa/

plist檔案範例如下:

  1. <?xml version="1.0" encoding="UTF-8"?>   
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">   
  3. <plist version="1.0">   
  4. <dict>   
  5.    <key>items</key>   
  6.    <array>   
  7.        <dict>   
  8.            <key>assets</key>   
  9.            <array>   
  10.                <dict>   
  11.                    <key>kind</key>   
  12.                    <string>software-package</string>   
  13.                    <key>url</key>   
  14.                    <string>ipa包的,如:http://www.tammy.com:450/static/ios/(targetname)_(version)_build(buildversion)_yyyyMMdd.ipa</string>   
  15.                </dict>   
  16.            </array>   
  17.            <key>metadata</key>   
  18.            <dict>   
  19.                <key>bundle-identifier</key>   
  20.                <string>應用程式中的<span style="font-family:FangSong_GB2312">bundle-identifier</span><span style="font-family:FangSong_GB2312"></string></span>   
  21.                <key>bundle-version</key>   
  22.                <string>版本號碼</string>   
  23.                <key>kind</key>   
  24.                <string>software</string>   
  25.                <key>subtitle</key>   
  26.                <string>子標題</string>   
  27.                <key>title</key>   
  28.                <string>軟體名稱</string>   
  29.            </dict>   
  30.        </dict>   
  31.    </array>   
  32. </dict>   
  33. </plist>   

html檔案範例如下:

  1. <span style="font-size:12px"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">   
  2. <html>   
  3. <head>   
  4.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">   
  5.   <meta http-equiv="Content-Style-Type" content="text/css">   
  6.   <title>測試包安裝</title>   
  7. </head>   
  8. <body>   
  9. <br>   
  10. <div style="position:absolute;left:200px" width=400><a href="../index.html">返回</a></div>   
  11.     <h1 align="center">開發版(TRUNK)</h1>   
  12.     <table align="center" border=1 width=400>   
  13.     <tr height=60>   
  14.         <th colspan=2><h2>標題</h2></th>   
  15.     </tr>   
  16.     <tr height=60 align="center">   
  17.         <td width=200><a href="itms-services://?action=download-manifest&url=</span><span style="font-size:10px"><span style="font-family:FangSong_GB2312">http://www.tammy.com:450/static/ios/****.plist</span><span style="font-family:FangSong_GB2312">"><h2>Install</h2></a></td></span></span><span style="font-size:12px">   
  18.         <td width=200><a href="</span><pre name="code" class="html" style="color:rgb(34,34,34); line-height:22px">http://www.tammy.com:450/static/ios/(targetname)_(version)_build(buildversion)_yyyyMMdd.ipa</pre>"><h2>Download</h2></a></td></tr>    </table><br></body></html> 

不通過App Store,直接安裝應用程式的實現步驟:

1、設定簽名

利用developer profile或者adhoc distribution profile簽名app,注意,不能使用distribution profile方式簽名;個人開發人員認證只能在100個裝置中實現無線安裝。

2、產生arichive

菜單:product->archive,完成後可以在organizer中看到產生的arichive。

3、產生ipa

選擇剛剛產生的arichive,點擊“Distribute...",彈出如介面,選擇第二個,點“next”,設定相關參數,一 定要勾選“save for enterprise distribution”。application url,是產生的ipa在伺服器的位置;title是安裝過程中出現的標題;large image url 和 smal image url是安裝過程中出現的表徵圖。點擊儲存,將產生兩個檔案:***.ipa和***.plist。

4、伺服器部署

將產生的***.ipa和***.plist檔案部署到伺服器,同時在伺服器產生一個html檔案,目的是點擊後開啟一個連結,這樣ios裝置就會執行指令自動安裝app了。要開啟的連結內容如下:

itms-services://?action=download-manifest&url=http://www.tammy.com:450/static/ios/****.plist

不通過AppStore,在iOS裝置上直接安裝應用程式的原理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.