1.需要一個html檔案,引導下載下傳使用者線上安裝ipa
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>一鍵安裝掌上綜調iPhone版</title>
</head>
<body>
<a href='itms-services://?action=download-manifest&url=http://222.177.4.242/ios/d.plist'>一鍵安裝掌上綜調iPhone版</a>
</body>
</html>
2. 上文中的d.plist檔案内容如下,其實它是一個XML檔案,有關plist檔案,請自行查閱google
<?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://222.177.4.242/download?attachId=022DB5EAF88A57B175D24060DCD1BA70</string>
</dict>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<string>http://222.177.4.242/ios/icon.png</string>
<string>full-size-image</string>
</array><key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.ccssoft.mopclient.chongqing</string>
<key>bundle-version</key>
<string>1.0.0</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>掌上綜調</string>
<key>title</key>
</dict>
</dict>
</array>
</dict>
</plist>
上面2中的http://222.177.4.242/download?attachId=022DB5EAF88A57B175D24060DCD1BA70 這是ipa包所在的網絡位址
3.自行找一個icon.png放在上面兩個檔案的同一個目錄,此圖檔用作在iphone上顯示程式圖示。 http://222.177.4.242/ios/icon.png
4.使用iphone safari浏覽器,浏覽http://222.177.4.242/ios/d.html檔案,即可安裝了。簡單吧。
iOS 7.1下itms-services線上安裝失敗的解決方法
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檔案的功能。
//------------------- 延伸: 關于https設定 ----------------------------------
1.upload your app.plist to dropbox 2.get shared link of app.plist, like https://www.dropbox.com/s/qgknrfngaxazm38/app.plist 3.replace www.dropbox.com with dl.dropboxusercontent.com in the link, like https://dl.dropboxusercontent.com/s/qgknrfngaxazm38/app.plist 4.write your download.html like <a href="itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/qgknrfngaxazm38/app.plist">INSTALL!!</a> 5.upload the download.html to dropbox 6.get shared link of download.html, like https://www.dropbox.com/s/gnoctp7n9g0l3hx/download.html 7.replace www.dropbox.com with dl.dropboxusercontent.com in the second link as well, like https://dl.dropboxusercontent.com/s/gnoctp7n9g0l3hx/download.html Now, visit https://dl.dropboxusercontent.com/s/gnoctp7n9g0l3hx/download.html in your device, you can install the app like before. 這個是通過上傳dropbox來解決,事實上,隻要找個可以以https方式共享外鍊的網盤,把plist檔案上傳就可以了!
上述方法通過測試可以解決提示“證書無效”的問題。下面介紹下步驟:
1、進入dropbox注冊一個賬号:https://www.dropbox.com/ ,并根據官網提示安裝dropbox
2、安裝成功後會自動在桌面上的名為使用者名的檔案夾(WIN7)建立一個名為Dropbox的檔案夾。将之前做好的plist檔案複制到此檔案夾中
3、plist檔案左下角有藍色圖示表示正在同步,變為綠色圖示表示完成同步。在plist檔案上點選右鍵,選擇“共享Dropbox連結”,會在狀态欄中提示已複制到剪貼闆
4、在記事本中粘貼出來,連結位址應為類似于:https://www.dropbox.com/s/qgknrfngaxazm38/app.plist
5、将這個連結中www.dropbox.com替換為dl.dropboxusercontent.com,結果類似于:https://dl.dropboxusercontent.com/s/qgknrfngaxazm38/app.plist
6、把這個連結替換itms:services://後url的參數,類似于:<a href="itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/qgknrfngaxazm38/app.plist">INSTALL!!</a>
完畢。