iOS 7.1正式版發布了,之前使用itms-services://URL方式在線安裝ipa文件的方法卻失效了,點擊的時候報錯為:“無法安裝應用程序,因xxx.com的證書無效”(錯誤界面見下圖),這應該怎么解決呢?
其實iOS 7.1修改了manifest.plist文件的訪問協議,之前可以通過http協議訪問,在iOS 7.1之后必須使用https協議方式訪問。
比如之前的鏈接代碼為:
itms-services://?action=download-manifest&url=http://example.com/manifest.plist
在iOS 7.1之后,就需要修改為:
itms-services://?action=download-manifest&url=https://example.com/manifest.plist
需要一個SSL證書才能夠實現在線安裝ipa文件的功能。
下面是把app放到web site,讓其他人通過Over the Air (OTA)下載安裝的步驟。
前提: 能安裝app的device需要被包含在你的provisioning profile里
ref link: https://help.apple.com/iosdeployment-apps/?lang=en-us#app43ad871e
Step 1 在你的project里,選擇"iOS Device" in the active scheme (如果選擇的是iPad simulator or iPhone simulator,那么menu "Product > Archive"是灰化的)
Step 2 select menu "Product > Archive"來為你的project創建一個archive (it is recommended that build your project again before this action)
Step 3 這時應該會自動彈出organizer window (之后你可以通過menu "Window > Organizer"來打開它),並顯示你剛創建的archive item in the archive list。Highlight the archive item, and then click "Distribute..." button
Step 4 select option "Save for enterprise or Ad-Hoc deployment", click "Next"
Step 5 set "Code Signing Identity" as default value, my default value is "Tomson Xu" (這應該是你在apple developer site創建的certificate name), click "Next"
Step 6 設置"Save as"為你的project name,設置存放生成文件的位置"Where",勾上"Save for Enterprise Distribution"。
Step 7 設置"Application URL"為即將生成的ipa將放到web site里的URL(e.g.http://xxx.xxx.xxx.xxx/CityUCAP.ipa),設置"Title"為任意text(注意它並不是安裝后的app display name), click "Save" button. 這時它將創建一個ipa file和一個與ipa file同名的plist file (假設為 CityUCAP.ipa and CityUCAP.plist)
Step 8 把step 7生成的ipa and plist file復制到你的web site里 (注意:其url要和step 7設置的”Application URL“一樣),然后創建一個html file as follow.
- <a href="itms-services://?action=download-manifest&url=http://xxx.xxx.xxx.xxx/ CityUCAP.plist">Install App</a>
Step 9 你需要添加2個MIME類型到你的web server,否則安裝過程中就有可能出錯。下面以IIS為例添加MIME type
1. 打開IIS Manager,左邊panel選定root node,然后在右邊的panel double click "MIME Types"
2. right click 任意位置, select "Add...",分別添加下列2個MIME Type