xcode 无效的捆绑包。“.app”中的包不包含包可执行文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33369619/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:07:22  来源:igfitidea点击:

Invalid Bundle. The bundle at '.app' does not contain a bundle executable

iosxcodexcode7

提问by Alkesh Fudani

I am trying to validate/submit my app, and it gives me this error. I tried all the possible suggestions mentioned in the previous replies to this question, neither of them worked.

我正在尝试验证/提交我的应用程序,但它给了我这个错误。我尝试了之前对这个问题的回复中提到的所有可能的建议,但都没有奏效。

I removed CFBundleKey, also changed CFBundlePackageType key's value from APPL to BNDL in the info.plist.

我删除了 CFBundleKey,还在 info.plist 中将 CFBundlePackageType 键的值从 APPL 更改为 BNDL。

I have also attached screenshot for the same.

我还附上了相同的截图。

please provide a solution to this, Thanks a ton in advance as I am badly stuck.

请提供一个解决方案,提前致谢,因为我被严重卡住了。

my app's bundle identifier is having a numeric value can it cause the issue??

我的应用程序的包标识符有一个数值会导致问题吗??

enter image description here

在此处输入图片说明

采纳答案by Alkesh Fudani

The connection to the info.plist file might be causing the issue. Try changing the bundle id from target and check if it reflects in the plist file and vice-versa. If this doesn't reflects copy your plist file at some other location, remove it from the app and drag and drop again, it will help. This solved my issue, hope it helps.

与 info.plist 文件的连接可能会导致该问题。尝试从 target 更改 bundle id 并检查它是否反映在 plist 文件中,反之亦然。如果这不能反映将您的 plist 文件复制到其他位置,请将其从应用程序中删除并再次拖放,它会有所帮助。这解决了我的问题,希望它有所帮助。

Thanks for the efforts.

感谢您的努力。

回答by Hardip Kalola

if you will get this error then check your info.plist file,

如果您会收到此错误,请检查您的 info.plist 文件,

<key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>

and add this key.

并添加这个键。

回答by zhangweiwei

You should enter general to find Embedded Binaries,and delete your frameworks.

您应该输入一般以查找嵌入式二进制文件,并删除您的框架。

回答by Rocksaurus

For future people coming from Google:

对于未来来自谷歌的人:

I recently had this problem (with a third party static library + bundle distributed to us) and tried everything I could and finally caved and was able to get through to Apple developer support. Turns out the creator of the bundle had put the Info.plist in the wrong place. Quoting the extremely knowledgeable and helpful person at Apple:

我最近遇到了这个问题(第三方静态库+分发给我们的包)并尝试了我所能做的一切,最终屈服并能够获得 Apple 开发人员的支持。结果发现包的创建者把 Info.plist 放在了错误的地方。引用 Apple 知识渊博且乐于助人的人的话:

The Info.plist needs to be at the root of the bundle, and not in the Resources folder. Since no Info.plist was found at the expected location to describe expectations of what the bundle is, it proceeded to look for executable code, as the iOS supported bundle types APPL, FMWK, and XPC are all expected to have a bundle executable.

Info.plist 需要位于包的根目录,而不是在 Resources 文件夹中。由于在预期位置没有找到 Info.plist 来描述对 bundle 的期望,它继续寻找可执行代码,因为 iOS 支持的 bundle 类型 APPL、FMWK 和 XPC 都期望有一个 bundle 可执行文件。

and

Moving the Info.plist file into the proper location is your short term workaround, but you should also look at eliminating the bundle entirely for the long term. If you open the new project window in Xcode, you'll see that a template for providing a general purpose bundle is only available in the macOS section, but not on iOS. Xcode never had a general purpose bundle starting point for iOS, so most developers have hand crafted bundles that approximate the expected structure for iOS out of the macOS base, but don't fully meet the expectations of the entire system, leading to a variety of unexpected issues, such as this one. If your bundle content is related to a framework, you can directly embed that content in the framework bundle, and if it's for the app, you can deploy the content directly into the main .app bundle.

将 Info.plist 文件移动到适当的位置是您的短期解决方法,但从长远来看,您还应该考虑完全消除捆绑包。如果您在 Xcode 中打开新项目窗口,您将看到用于提供通用捆绑包的模板仅在 macOS 部分可用,而在 iOS 上不可用。Xcode 从来没有一个适用于 iOS 的通用 bundle 起点,因此大多数开发人员在 macOS 基础上手工制作了近似于 iOS 预期结构的 bundle,但并没有完全满足整个系统的期望,导致各种意想不到的问题,比如这个。如果您的 bundle 内容与框架相关,您可以直接将该内容嵌入到框架 bundle 中,如果是用于应用程序,您可以将内容直接部署到 main 中。

and

Bundles don't exist on iOS, specifically in the BNDL sense. They are a macOS concept that is intended to contain loadable code for plug-ins, which doesn't exist on iOS, and that part is documented at the following location: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW30

Using a BNDL as a container for resources without loadable code on iOS is a convention that evolved in the developer community. The way they are used on iOS, as seen by the several bundles in your app, is effectively as a folder with a fancy file name for organizational reasons. Using a folder without the .bundle file extension would serve the same organizational purpose, while also avoiding getting caught up in the validation process trying to determine if what it discovered was an application, framework, or app extension bundle.

捆绑包在 iOS 上不存在,特别是在 BNDL 意义上。它们是一个 macOS 概念,旨在包含插件的可加载代码,在 iOS 上不存在,该部分记录在以下位置:https: //developer.apple.com/library/archive/documentation /CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW30

在 iOS 上使用 BNDL 作为没有可加载代码的资源容器是开发者社区中发展起来的约定。它们在 iOS 上的使用方式,正如您的应用程序中的几个捆绑包所见,出于组织原因,实际上是一个带有花哨文件名的文件夹。使用没有 .bundle 文件扩展名的文件夹可以达到相同的组织目的,同时也避免陷入验证过程,试图确定它发现的是应用程序、框架还是应用程序扩展包。

So in conclusion: avoid using bundles in iOS. You risk eventually tripping up Apple's at times opaque validation process for little perceptible gain.

所以总而言之:避免在 iOS 中使用捆绑包。您可能最终会绊倒 Apple 有时不透明的验证过程,但几乎没有什么可察觉的收益。