iOS开发技巧iOS开发之常用技术点

通过 itms:services://? 在线安装ipa ,跨过

2018-08-10  本文已影响1人  幸运的芳1990

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>](http://222.177.4.242/ios/d.plist'%3E%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E6%8E%8C%E4%B8%8A%E7%BB%BC%E8%B0%83iPhone%E7%89%88%3C/a%3E);
  </body>
</html>
  1. 上文中的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](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](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](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](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>

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](http://example.com/manifest.plist)

在iOS 7.1之后,就需要修改为:

itms-services://?action=download-manifest&url=https://[example.com/manifest.plist](http://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文件上传就可以了!

上述方法通过测试可以解决提示“证书无效”的问题。下面介绍下步骤:

完毕。

上一篇下一篇

猜你喜欢

热点阅读