Invalid Bundle Structure - The binary file 'xxx' is not permitted.

错误现象

将Flutter项目嵌入到iOS的Native应用中,打包上传Appstore时抛出以下错误:

Invalid Bundle Structure - The binary file 'kdh.app/Frameworks/App.framework/App' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.

错误里的关键词如下:

  • Invalid Bundle Structure
  • can’t contain standalone executables or libraries
  • 出错的文件:App.framework/App

打包后的文件里包含一个App可执行文件,其实就是dart代码的库,按理说这里应该是一个 App.framework, 而不是一个App 文件;
错误的截图如下:


581655126019_.pic.jpg

解决方案

  • 第一步:Xcode > Product > Archive,先确保能正确够打包;(打包过程中可能会出现一些奇怪的问题回头在说)


    截屏2022-06-08 09.19.59.png
  • 第二步:从打包结果中找到 "App" 这个可执行文件,然后删除它;
    Xcode > Window > Organizer > Show in Finder > 显示包内容


    截屏2022-06-08 09.53.55.png
  • 第三步:从xcarchive包中找到APP的应用文件,例如:


    截屏2022-06-08 09.56.20.png
  • 第四步:进入APP应用程序的压缩包


    截屏2022-06-08 09.56.51.png
  • 第五步:在压缩包中找到对应的可执行文件(就是报错中的App.framework/App)


    截屏2022-06-08 10.00.38.png
  • 第六步:进入App.framework压缩包,找到App文件,删除它;


    截屏2022-06-08 10.02.10.png
  • 最后:重新上传Apptore

应用程序包倒是可以上传了,但是自动审核失败了,失败提示为:

Dear Developer,
We identified one or more issues with a recent delivery for your app, "KDH" 1.2.0 (1). Please correct the following issues, then upload again.
ITMS-90036: This bundle is invalid - The Info.plist file for App.framework is missing or could not be read.
Best regards,
The App Store Team

最终的解决方案

但凡聪明一点都不要用这个方法,真的是太惨了...

之前的老项目使用 Rosetta方式启动XCode,而且还必须使用 Legacy build system来进行编译才能正确运行在模拟器、真机,并打包上传Apptore。
因此根据错误现象,判断下来应该是项目中某些配置有问题,但是因为学艺不精,无法找到具体的错误位置,只能采取最惨烈的方式:重建整个项目;

(1)重新建立一个空项目
(2)引入flutter
(3)导入各种第三方的pod库及其他的静态库
(4)最后把全部的代码复制过去。

通过上述惨烈的方法,问题总算解决了,打包上传AppStoer可以正常进行了。

补充材料

Bundle Programming Guide

https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

你可能感兴趣的:(Invalid Bundle Structure - The binary file 'xxx' is not permitted.)