xcode - 无效的位码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43215407/
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
xcode - invalid bitcode
提问by Bill
I'm getting this error
我收到这个错误
error: Invalid bitcode signature
clang: error: linker command failed with exit code 1 (use -v to see invocation)
错误:无效的位码签名
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
I am using cocoapods and I have verified that all enable bitcodes match, I've tried all options Yes, No and ${inherited} for the enable bitcode field.
我正在使用 cocoapods 并且我已经验证所有启用位码匹配,我已经尝试了启用位码字段的所有选项是、否和 ${inherited}。
Not sure how to debug this further, how to I use the -v option / will that even give me more information.
不知道如何进一步调试,如何使用 -v 选项/甚至会给我更多信息。
Some back ground, I'm merging two code bases together iPhone and iPad so that it's a universal app.
在某些背景下,我将 iPhone 和 iPad 的两个代码库合并在一起,使其成为通用应用程序。
回答by Florian
In my project I fixed this by setting all "Bitcode enabled" options to "No". That includes all targets and all projects in the workspace (main project, Cocoa Pod project).
在我的项目中,我通过将所有“启用位码”选项设置为“否”来解决此问题。这包括工作区中的所有目标和所有项目(主项目、Cocoa Pod 项目)。
回答by HA S
error: Invalid bitcode signature clang: error: linker command failed with exit code 1 (use -v to see invocation)
错误:无效的位码签名 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
Note: If you are building for the target phone 9 or 10 the following solution solves the issue
注意:如果您为目标手机 9 或 10 构建,以下解决方案可解决此问题
Solution
解决方案
- Open Podfile
- Uncomment this line ~> platform :ios, '9.0'
- From the command line run the following command where Podfile resides
- pod update
- In the xcode select Product > clean and then Product > Build
- 打开 Podfile
- 取消注释这一行 ~> platform :ios, '9.0'
- 从命令行运行以下 Podfile 所在的命令
- 豆荚更新
- 在 xcode 中选择 Product > clean 然后选择 Product > Build
Hope this solves the problem
希望这能解决问题
回答by Dearwolves
If you have a static library (ends with .a), It's possible that its bitcode settings is not agreeing to your workspace / project.
如果您有一个静态库(以 .a 结尾),它的位码设置可能与您的工作区/项目不一致。
回答by Sean Choe
回答by Nathan Barreto
Using pod deintegrateand pod installagain resolved my problem. It might be helpful to other who have this question.
再次使用pod deintegrate和pod install解决了我的问题。这可能对有此问题的其他人有所帮助。
回答by jakob.j
For me it helped to "update project to recommended settings" and clean, credits to Rocksaurus: https://stackoverflow.com/a/47336130/1884907
对我来说,它有助于“将项目更新为推荐设置”并清理 Rocksaurus 的功劳:https://stackoverflow.com/a/47336130/1884907
回答by T.V.
Cleaning Derived data folder worked for me.
清理派生数据文件夹对我有用。
回答by Nikolaj Nielsen
I got the same error after doing a pod update
- restarting Xcode did the trick for me.
执行后我遇到了同样的错误pod update
- 重新启动 Xcode 对我有用。
回答by Snips
I was having this problem since adding Cocoapods (actually added to start using ResearchKit).
自从添加 Cocoapods(实际上是添加到开始使用 ResearchKit)后,我就遇到了这个问题。
I had gone through and ensured bitcode enabled was set to NO, but thought it odd that the 'Pods' project (within the project workspace) didn't have a definition for 'Bitcode Enabled' under Build Settings. After lots of frustration, I tried adding the 'Bitcode Enabled' setting for the ResearchKit project (I just cut&pasted the key/values from my main app project for accuracy).
我已经检查并确保启用位码设置为 NO,但认为“Pods”项目(在项目工作区中)在“构建设置”下没有“启用位码”的定义很奇怪。在经历了很多挫折之后,我尝试为 ResearchKit 项目添加“启用位码”设置(为了准确起见,我只是从主应用程序项目中剪切并粘贴了键/值)。
Hey presto! This got me past this error, and I just had to fix some arch related things and I was up and running again.
嘿快点!这让我克服了这个错误,我只需要修复一些与拱门相关的东西,然后我又开始运行了。
I guess if there isn't a Bitcode Enabled key/value defined, it defaults to YES.
我想如果没有定义启用 Bitcode 的键/值,它默认为 YES。
回答by Suresh D
Maybe the issue because of a third party SDK integrated into your project using Cocoapods.
问题可能是因为使用 Cocoapods 将第三方 SDK 集成到您的项目中。
do the following:
请执行下列操作:
- Create a new Xcode project
- Copy the Podfile from your original project to the newly created project's directory
- Do pod install
- Remove one or more of the pods?
Archive the new project, and see if it succeeds, if not repeat step 4 till you are able to archive.
(you can also try something like binary search, wherein you delete the first half pods in your Podfile and see if the new project archives)
- 创建一个新的 Xcode 项目
- 将原始项目中的 Podfile 复制到新创建的项目目录中
- 做 pod 安装
- 移除一个或多个 Pod?
将新项目归档,看看是否成功,如果不成功则重复步骤 4,直到可以归档为止。
(您也可以尝试二进制搜索之类的方法,其中删除 Podfile 中的前半个 Pod 并查看新项目是否存档)
Once you've figured out the library causing the issue, keep downgrading the library by explicitly specifying the version in Podfile, until the project archives successfully.
一旦找出导致问题的库,请通过在 Podfile 中明确指定版本来继续降级库,直到项目成功归档。
Or if you don't mind disabling bitcode: Go to build settings search bitcode and change "Enable Bitcode" to "No".
或者,如果您不介意禁用位码:转到构建设置搜索位码并将“启用位码”更改为“否”。