周寫了一個iOS系統在沒有上架蘋果應用商店的情況下,通過企業證書安裝 ipa 軟件的實例。
教程簡介:
1、利用 itms-services 和 plist 文件,在線下載安裝 ipa 文件。
2、直接跳轉【設置-通用-描述文件】,信任證書。
首先需要特別注意:
1、ipa 的下載地址放到 plist 的文件中,鏈接指定 plist(格式見下文)
2、plist 的鏈接必須是 https (SSL加密)的,而且必須是公網,自簽名及免費的 https 不可用。
3、鏈接格式要求一定是符合蘋果規范的,itms-services://?action=download-manifest&url=https://****/***.plist
目前可以使用 https 測試用的域名:https://raw.githubusercontent.com/
下載安裝ipa:
將 plist 上傳到 github 上,查看 plist 內容頁面上右上角點擊“Raw”。
使用該地址鏈接格式為 https://raw.githubusercontent.com/用戶名/項目名/master/xxxx.plist
拼接鏈接: itms-services://?action=download-manifest&url=
https://raw.githubusercontent.com/用戶名/項目名/master/xxxx.plist
在 iPhone 手機中打開 Safari ,訪問該鏈接,提示:在"iTunes"中打開鏈接嗎?,點擊打開。
提示“raw.githubusercontent.com”要安裝“XXXXX”,點擊安裝即可在線下載安裝 ipa 。
點擊直接跳轉信任證書:
針對企業應用安裝后如何在 Safari 中引導用戶跳轉到 [設置 - 通用 - 描述文件] 頁面,以便用戶信任企業簽名描述文件,在 iOS9 的時候很方便,無論是在應用內還是在 Safari 中都可以直接喚起,但是從 iOS10 起,蘋果禁止了一切對 [設置] 的主動跳轉。
iOS9 |
iOS10 |
in-App (openURL) | ✓ |
Safari | ✓ |
另外還測試了一下,在應用內用 UIWebView 加載 HTML 進行跳轉,結論與上一致。
URL Scheme
iOS 9 : prefs:root=General&path=ManagedConfigurationList iOS 10 : App-Prefs:root=General&path=ManagedConfigurationList
解決:
可以看到 iOS10 並不能從 Safari 直接跳轉 [描述文件] 了,但是還有一個方式可以達到該效果,直接鏈接到一個企業簽名的描述文件(.mobileprovision
),在 Safari 中直接訪問 https://raw.githubusercontent.com/用戶名/項目名/master/hello.mobileprovision
(你的企業描述文件地址)就可以實現跳轉了。
.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>http://xxxxxxxxxxxxxxxxxxx/xxx.ipa</string> </dict> <dict> <key>kind</key> <string>full-size-image</string> <key>needs-shine</key> <true/> <key>url</key> <string>http://xxxxxxxxxxxxxxxxxx.png</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>needs-shine</key> <true/> <key>url</key> <string>http://xxxxxxxxxxxxxxxxxx.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>com.xxxx.demo</string> <key>bundle-version</key> <string>1.0.0</string> <key>kind</key> <string>software</string> <key>title</key> <string>XXXX App download</string> </dict> </dict> </array> </dict> </plist>
參考文檔: