iOS9企业分发无法下载

原文链接:https://github.com/ChenYilong/iOS9AdaptationTips/blob/master/README.md


iOS9以后,企业分发时可能存在:下载的ipa包与网页两者的 bundle ID 无法匹配而导致下载失败的情况


iOS9升级后众多企业分发的 app 已经出现了不能安装的情况,而iOS8或更早的系统不受影响。那是因为从iOS9以后,系统会在 ipa 包下载完之后,拿ipa包中的 bundle ID 与网页中的 plist 文件中的 bundle ID 进行比对,不一致不允许安装。

错误提示如下:

enter image description here

网页中的 plist 文件中的 bundle ID 的作用可参考 《iOS:苹果企业证书通过网页分发安装app》 。

正如这篇文章提到的,“网页中的 plist 文件”是习惯的叫法,也有人称作“manifest文件”,比如 这篇文章

而iOS9之前,苹果不会检查这一项,因此iOS9之前可以安装。

导致这一错误的原因除了粗心,还有开发者是故意设置不一致,据开发者说:

当初服务器 plist 的 bundle id 上故意做成成不一致。是为了解决一些人安装不上的问题。

详情可参考: 《升级到ios 9,企业版发布现在无法安装成功了,有人遇到了这种问题吗?》

如何知道是因为 bundle id 不一致造成的无法安装?

通过查看设备上的日志信息:有一个 itunesstored 进程提示安装信息:

  itunesstored →  <Warning>: [Download]: Download task did finish: 8 for download: 2325728577585828282
  itunesstored →  <Warning>: [ApplicationWorkspace] Installing download: 2325728577585828282 with step(s): Install
  itunesstored →  <Warning>: [ApplicationWorkspace]: Installing software package with bundleID: com.***.***: bundleVersion: 1.01 path: /var/mobile/Media/Downloads/2325728577585828282/-1925357977307433048
  itunesstored →  <Warning>: BundleValidator: Failed bundleIdentifier: com.***.**** does not match expected bundleIdentifier: com.***.*********
  itunesstored →  <Warning>: [ApplicationWorkspace]: Bundle validated for bundleIdentifier: com.****.******success: 0
  itunesstored →  <Warning>: LaunchServices: Uninstalling placeholder for app <LSApplicationProxy: 0x12677be70> com.****.*******(Placeholder) <file:///private/var/mobile/Containers/Bundle/Application/B62D8EA3-2052-4393-8A7E-3FD27228BFC2/2325728577585828282.app>
  itunesstored →  <Warning>: LaunchServices: Uninstalling app <LSApplicationProxy: 0x12677be70> com.****.*****(Placeholder) <file:///private/var/mobile/Containers/Bundle/Application/B62D8EA3-2052-4393-8A7E-3FD27228BFC2/2325728577585828282.app>

其中的这一句很重要:

 itunesstored →  <Warning>: BundleValidator: Failed bundleIdentifier: com.***.**** does not match expected bundleIdentifier: com.***.*********

经过核对,果然是.ipa文件中真实的Bundle ID和manifest文件中配置的信息不匹配,然后测试发现:

iOS 9是校验bundle-identifier值的,而iOS 9以下版本是不校验,一旦iOS 9发现bundle-identifier不匹配,即使下载成功了,也会 Uninstall(日志中提示的)app的。

适配方法:

  1. 两者的 bundle id 修改一致

    一旦出现iOS9能够安装企业版本APP,iOS9以下版本不能安装,一定先查看安装日志,然后核对每个参数配置。

    manifest文件的参考配置。

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <!-- array of downloads. -->
    <key>items</key>
    <array>
       <dict>
           <!-- an array of assets to download -->
           <key>assets</key>
           <array>
               <!-- software-package: the ipa to install. -->
               <dict>
                   <!-- required.  the asset kind. -->
                   <key>kind</key>
                   <string>software-package</string>
                   <!-- optional.  md5 every n bytes.  -->
                   <!-- will restart a chunk if md5 fails. -->
                   <key>md5-size</key>
                   <integer>10485760</integer>
                   <!-- optional.  array of md5 hashes -->
                   <key>md5s</key>
                   <array>
                       <string>41fa64bb7a7cae5a46bfb45821ac8bba</string>
                       <string>51fa64bb7a7cae5a46bfb45821ac8bba</string>
                   </array>
                   <!-- required.  the URL of the file to download. -->
                   <key>url</key>
                   <string>http://www.example.com/apps/foo.ipa</string>
               </dict>
               <!-- display-image: the icon to display during download. -->
               <dict>
                   <key>kind</key>
                   <string>display-image</string>
                   <!-- optional. icon needs shine effect applied. -->
                   <key>needs-shine</key>
                   <true/>
                   <key>url</key>
                   <string>http://www.example.com/image.57×57.png</string>
               </dict>
               <!-- full-size-image: the large 512×512 icon used by iTunes. -->
               <dict>
                   <key>kind</key>
                   <string>full-size-image</string>
                   <!-- optional.  one md5 hash for the entire file. -->
                   <key>md5</key>
                   <string>61fa64bb7a7cae5a46bfb45821ac8bba</string>
                   <key>needs-shine</key>
                   <true/>
                   <key>url</key>
                   <string>http://www.example.com/image.512×512.jpg</string>
               </dict>
           </array><key>metadata</key>
           <dict>
               <!-- required -->
               <key>bundle-identifier</key>
               <string>com.example.fooapp</string>
               <!-- optional (software only) -->
               <key>bundle-version</key>
               <string>1.0</string>
               <!-- required.  the download kind. -->
               <key>kind</key>
               <string>software</string>
               <!-- optional. displayed during download; -->
               <!-- typically company name -->
               <key>subtitle</key>
               <string>Apple</string>
               <!-- required.  the title to display during the download. -->
               <key>title</key>
               <string>Example Corporate App</string>
           </dict>
       </dict>
    </array>
    </dict>
    </plist>
  2. 使用fir.im等第三方分发平台:上述“ bundle id 不一致导致下载失败”这种情况只会出现在企业自己搭建网页分发的情形下,事实证明第三方的分发平台更加专业,已经很好地规避了该情况的发生。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值