xcode 无效的包结构 - 应用程序可能只包含一个可执行文件。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20251252/
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
Invalid bundle structure - The app may contain only one executable file.
提问by ToddB
This questionis similar if not identical but there is no solution. I've looked inside the archive and there's only one executable, so I am at a loss as to how to proceed. Any ideas greatly appreciates.
这个问题是相似的,如果不相同,但没有解决方案。我查看了存档内部,只有一个可执行文件,所以我不知道如何继续。任何想法都非常感谢。




采纳答案by ToddB
In hindsight the error is straightforward. An executable file was accidentally added to the project. In my case "Develop!.app/Xcode" meant that Xcode was the executable. Checking the list of files in the project I found a symlink to Xcode. (Maybe I dragged it from the dock somehow and dropped it into the project).
事后看来,这个错误很简单。一个可执行文件被意外添加到项目中。就我而言,“ Develop!.app/Xcode” 表示 Xcode 是可执行文件。检查项目中的文件列表,我发现了一个指向 Xcode 的符号链接。(也许我以某种方式将它从 Dock 中拖出并放入项目中)。
If you are getting this error look at the files in your project -- there is an executable there somewhere.
如果您遇到此错误,请查看项目中的文件——某处有一个可执行文件。
回答by pkamb
Invalid Build Structure
The binary file
'YourApp.app/libYourLibrary.a'is not permitted.Your app may contain only one executable file.
无效的构建结构
'YourApp.app/libYourLibrary.a'不允许使用二进制文件。您的应用程序可能只包含一个可执行文件。
This error occurs when a static library file is mistakenly copied into the app bundle.
当静态库文件被错误地复制到应用程序包中时,会发生此错误。
You should link the libYourLibrary.astatic library via a Link Binary with Librariesbuild phase.
您应该libYourLibrary.a通过链接二进制文件与库构建阶段链接静态库。
It should NOTbe added to the target's Copy Bundle Resourcesbuild phase.
它应该不被添加到目标的复制包资源构建阶段。
回答by Ash
My app was rejected with the same error message. It turned out that I was copying a third party framework (Fiksu) in the 'Copy Bundle Resources' build phase. The framework contained an executable and was already linked to in the 'Link Binary With Libraries' build phase. I deleted the framework from the 'Copy Bundle Resources' build phase. The framework continued to work normally in a release build. I resubmitted the app and it passed validation. Similar solution was posted here:
我的应用程序被拒绝并显示相同的错误消息。事实证明,我在“复制捆绑资源”构建阶段复制了第三方框架 (Fiksu)。该框架包含一个可执行文件,并且已经在“将二进制文件与库链接”构建阶段链接到。我从“复制捆绑资源”构建阶段删除了框架。该框架在发布版本中继续正常工作。我重新提交了应用程序,它通过了验证。类似的解决方案张贴在这里:
回答by Stephen Watson
I had this issue for the first time on an app I'd submitted over several versions with no issues.
我第一次在一个应用程序上遇到了这个问题,我提交了多个版本,没有任何问题。
I found that somehow that although I'd linked to one of my own libraries, one of the source files from that same library appeared in the list of files in the "Copy Bundle Resources" list. I have no idea how it got there but removing it meant that my app build, archived and was submitted successfully. :-)
我发现尽管我链接到我自己的库之一,但来自同一库的源文件之一出现在“复制捆绑资源”列表中的文件列表中。我不知道它是如何到达那里的,但删除它意味着我的应用程序构建、存档并已成功提交。:-)
回答by Venu Gopal Tewari
If you are getting error in following format: "Invalid Bundle Structure - The binary file 'Abc.app/AnyFileName.o' is not permitted.
如果您收到以下格式的错误:“无效的捆绑结构 - 不允许使用二进制文件‘Abc.app/AnyFileName.o’。
Build Phases > Copy Bundle Resources > check your file AnyFileName.swift will be added too here. (Remove it)
Build Phases > Copy Bundle Resources > 检查你的文件 AnyFileName.swift 也会被添加到这里。(去掉它)
validate it with XCode. Error gone !!
使用 XCode 验证它。错误消失了!!
回答by FARAZ
In my case I tried to remove references but nothing worked for me. Then I uninstall particular pod, remove references as mentioned here and then install that particular pod again. It worked for me.
就我而言,我尝试删除引用,但没有任何效果。然后我卸载特定的 pod,删除这里提到的引用,然后再次安装该特定的 pod。它对我有用。
For those who required elaboration check below:
对于那些需要详细检查以下内容的人:
1) In Podfile comment the particular pod by adding # in the beginning and save it:
1) 在 Podfile 中,通过在开头添加 # 来注释特定的 Pod 并保存它:
On command line run: pod install// It will uninstall that framework
在命令行上运行:pod install// 它将卸载该框架
2) Removed references of that framework from:
2) 从以下内容中删除了对该框架的引用:
- Link Binary with Libraries // In Build Phase
- Copy Bundle Resources // In Build Phase
- Embed Frameworks
- 将二进制文件与库链接 // 在构建阶段
- 复制捆绑资源 // 在构建阶段
- 嵌入框架
3) Now install Pod again, Remove # which you added before and save it.
3)现在再次安装Pod,删除您之前添加的#并保存它。
On command line run: pod install// It will install that framework again
在命令行运行:pod install// 它将再次安装该框架
回答by horppe
What eventually worked for me was clearing my Cocoa Pods cache and reinstall all Pods
最终对我有用的是清除我的 Cocoa Pods 缓存并重新安装所有 Pods
rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

