不通過AppStore,在iOS設(shè)備上直接安裝應(yīng)用程序的原理
通過itms-services協(xié)議,可以通過safari瀏覽器直接在iOS設(shè)備上安裝應(yīng)用程序。利用這種方式,只要在內(nèi)網(wǎng)布置一個(gè)服務(wù)器,測(cè)試人員只需要通過測(cè)試設(shè)備的safari瀏覽器訪問特定的url既可以實(shí)現(xiàn)安裝,然后測(cè)試了。(PS:越獄設(shè)備也可以)
itms- services協(xié)議需要一個(gè)plist配置文件。如果要實(shí)現(xiàn)上面圖示的功能,需要的文件有:一個(gè)ipa文件,一個(gè)plist文件,一個(gè)html文件和一 個(gè)圖片文件。其中,最主要的,就是plist文件。通過shell腳本,我們可以讓其自動(dòng)為我們生成plist文件和html文件,并且在xcode工程 中的ipa文件和程序圖標(biāo)文件復(fù)制一份,放到一起。
《xcode自動(dòng)打ipa包腳本》學(xué)習(xí)地址: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>應(yīng)用程序中的<span style="font-family:FangSong_GB2312">bundle-identifier</span><span style="font-family:FangSong_GB2312"></string></span>
- <key>bundle-version</key>
- <string>版本號(hào)</string>
- <key>kind</key>
- <string>software</string>
- <key>subtitle</key>
- <string>子標(biāo)題</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>測(cè)試包安裝</title>
- </head>
- <body>
- <br>
- <div style="position:absolute;left:200px" width=400><a href="../index.html">返回</a></div>
- <h1 align="center">開發(fā)版(TRUNK)</h1>
- <table align="center" border=1 width=400>
- <tr height=60>
- <th colspan=2><h2>標(biāo)題</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,直接安裝應(yīng)用程序的實(shí)現(xiàn)步驟:
1、設(shè)置簽名
利用developer profile或者adhoc distribution profile簽名app,注意,不能使用distribution profile方式簽名;個(gè)人開發(fā)者證書只能在100個(gè)設(shè)備中實(shí)現(xiàn)無線安裝。
2、生成arichive
菜單:product->archive,完成后可以在organizer中看到生成的arichive。
3、生成ipa
選擇剛剛生成的arichive,點(diǎn)擊“Distribute...",彈出如下圖界面,選擇第二個(gè),點(diǎn)“next”,設(shè)置相關(guān)參數(shù),一 定要勾選“save for enterprise distribution”。application url,是生成的ipa在服務(wù)器的位置;title是安裝過程中出現(xiàn)的標(biāo)題;large image url 和 smal image url是安裝過程中出現(xiàn)的圖標(biāo)。點(diǎn)擊保存,將生成兩個(gè)文件:***.ipa和***.plist。
4、服務(wù)器部署
將生成的***.ipa和***.plist文件部署到服務(wù)器,同時(shí)在服務(wù)器生成一個(gè)html文件,目的是點(diǎn)擊后打開一個(gè)鏈接,這樣ios設(shè)備就會(huì)執(zhí)行指令自動(dòng)安裝app了。要打開的鏈接內(nèi)容如下:
itms-services://?action=download-manifest&url=http://www.tammy.com:450/static/ios/****.plist