通過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文件范例如下:
- <?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包的下載地址,如:http://www.tammy.com:450/static/ios/(targetname)_(version)_build(buildversion)_yyyyMMdd.ipa</string>
- </dict>
- </array>
- <key>metadata</key>
- <dict>
- <key>bundle-identifier</key>
- <string>應用程序中的<span style="font-family:FangSong_GB2312">bundle-identifier</span><span style="font-family:FangSong_GB2312"></string></span>
- <key>bundle-version</key>
- <string>版本號</string>
- <key>kind</key>
- <string>software</string>
- <key>subtitle</key>
- <string>子標題</string>
- <key>title</key>
- <string>軟件名稱</string>
- </dict>
- </dict>
- </array>
- </dict>
- </plist>
html文件范例如下:
- <span style="font-size:12px"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <title>測試包安裝</title>
- </head>
- <body>
- <br>
- <div style="position:absolute;left:200px" width=400><a href="../index.html">返回</a></div>
- <h1 align="center">開發版(TRUNK)</h1>
- <table align="center" border=1 width=400>
- <tr height=60>
- <th colspan=2><h2>標題</h2></th>
- </tr>
- <tr height=60 align="center">
- <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">
- <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