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 进行比对,不一致不允许安装。

错误提示如下:

iOS9企业分发无法下载_第1张图片

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

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

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

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

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

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

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

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

  itunesstored →  : [Download]: Download task did finish: 8 for download: 2325728577585828282
  itunesstored →  : [ApplicationWorkspace] Installing download: 2325728577585828282 with step(s): Install
  itunesstored →  : [ApplicationWorkspace]: Installing software package with bundleID: com.***.***: bundleVersion: 1.01 path: /var/mobile/Media/Downloads/2325728577585828282/-1925357977307433048
  itunesstored →  : BundleValidator: Failed bundleIdentifier: com.***.**** does not match expected bundleIdentifier: com.***.*********
  itunesstored →  : [ApplicationWorkspace]: Bundle validated for bundleIdentifier: com.****.******success: 0
  itunesstored →  : LaunchServices: Uninstalling placeholder for app  com.****.*******(Placeholder) 
  itunesstored →  : LaunchServices: Uninstalling app  com.****.*****(Placeholder) 

其中的这一句很重要:

 itunesstored →  : 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>
    
    <key>itemskey>
    <array>
       <dict>
           
           <key>assetskey>
           <array>
               
               <dict>
                   
                   <key>kindkey>
                   <string>software-packagestring>
                   
                   
                   <key>md5-sizekey>
                   <integer>10485760integer>
                   
                   <key>md5skey>
                   <array>
                       <string>41fa64bb7a7cae5a46bfb45821ac8bbastring>
                       <string>51fa64bb7a7cae5a46bfb45821ac8bbastring>
                   array>
                   
                   <key>urlkey>
                   <string>http://www.example.com/apps/foo.ipastring>
               dict>
               
               <dict>
                   <key>kindkey>
                   <string>display-imagestring>
                   
                   <key>needs-shinekey>
                   <true/>
                   <key>urlkey>
                   <string>http://www.example.com/image.57×57.pngstring>
               dict>
               
               <dict>
                   <key>kindkey>
                   <string>full-size-imagestring>
                   
                   <key>md5key>
                   <string>61fa64bb7a7cae5a46bfb45821ac8bbastring>
                   <key>needs-shinekey>
                   <true/>
                   <key>urlkey>
                   <string>http://www.example.com/image.512×512.jpgstring>
               dict>
           array><key>metadatakey>
           <dict>
               
               <key>bundle-identifierkey>
               <string>com.example.fooappstring>
               
               <key>bundle-versionkey>
               <string>1.0string>
               
               <key>kindkey>
               <string>softwarestring>
               
               
               <key>subtitlekey>
               <string>Applestring>
               
               <key>titlekey>
               <string>Example Corporate Appstring>
           dict>
       dict>
    array>
    dict>
    plist>
  2. 使用fir.im等第三方分发平台:上述“ bundle id 不一致导致下载失败”这种情况只会出现在企业自己搭建网页分发的情形下,事实证明第三方的分发平台更加专业,已经很好地规避了该情况的发生。


你可能感兴趣的:(iOS9)