1. 程式人生 > >通過 itms:services://? 線上安裝ipa ,跨過app-store

通過 itms:services://? 線上安裝ipa ,跨過app-store

1.需要一個html檔案,引導下載使用者線上安裝ipa

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>一鍵安裝掌上綜調iPhone版</title>
  </head>
  
  <body>
        <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>
               <dict>
                   <key>kind</key>
                   <string>display-image</string>
                   <key>needs-shine</key>
                   <true/>
                   <key>url</key>
                   <string>http://222.177.4.242/ios/icon.png</string>
               </dict>
               <dict>
                   <key>kind</key>
                   <string>full-size-image</string>
                   <key>needs-shine</key>
                   <true/>
                   <key>url</key>
                   <string>http://222.177.4.242/ios/icon.png</string>
               </dict>
           </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>
               <string>掌上綜調</string>
           </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>

完畢。