ios app 企业证书分发及在线安装

来源:互联网 发布:腾讯软件中心手机软件 编辑:程序博客网 时间:2024/05/16 06:32

企业级分发

有两处变化:

  1. iOS9以后,企业级分发ipa包将遭到与Mac上dmg安装包一样的待遇:默认不能安装,也不再出现“信任按钮”
  2. iOS9以后,企业分发时可能存在:下载的ipa包与网页两者的 bundle ID 无法匹配而导致下载失败的情况

1. iOS9以后,企业级分发ipa包将遭到与Mac上dmg安装包一样的待遇:默认不能安装,也不再出现“信任按钮”

iOS9之前,企业级分发十分方便:点击App出现“信任按钮”,

enter image description here

iOS9以后,企业级分发ipa包将遭到与Mac上dmg安装包一样的待遇:默认不能安装,也不再出现“信任按钮”

enter image description here

必须让用户进行gif图中的设置:

enter image description here

2. 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 不一致导致下载失败”这种情况只会出现在企业自己搭建网页分发的情形下,事实证明第三方的分发平台更加专业,已经很好地规避了该情况的发生。

Q-A

Q:企业分发,企业版证书在iOS9上安装应用报 Ignore manifest download, already have bundleID: com.mycom.MyApp 只有我的手机无法安装,别人 iOS9 都可以安装

A:这并非 iOS9的问题,iOS8及以前的系统也会出现,和缓存有关系,请尝试关机重启手机,然后就可以安装了

0 0