每次我从CocoaPods导入文件时,我都会得到一个Apple Mach-O链接器错误。

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FBSession", referenced from: someFile
ld: symbol(s) not found for architecture arm64

我有大约12个这样的耳机,用于我使用的各种pod。

我试图使用XCode 5为iPhone 5S构建。

我一直在尝试各种解决方案这里所以,但还没有得到任何工作。

我如何解决这个苹果Mach-O链接错误?


刚刚发现了另一个可能很有趣的警告,我希望这能让我找到解决方案:

Ignoring file ~/Library/Developer/Xcode/DerivedData/SomeApp/Build/Products/Debug-iphoneos/libPods.a, 

~/Library/Developer/Xcode/DerivedData/someApp/Build/Products/Debug-iphoneos/libPods.a


当前回答

下面是为什么build_active_architecture设置为NO的一些解释。 Xcode现在会检测你连接了哪些设备,并相应地设置活动架构。所以如果你把第二代iPod Touch插到你的电脑上,Xcode应该把活动架构设置为armv6。用上面的Debug配置构建你的目标现在只构建armv6二进制代码来节省时间(除非你有一个巨大的项目,你可能没有注意到区别,但我猜时间会随着时间的推移而增加)。

当你创建一个发布到App Store的Distribution配置时,你应该确保这个选项没有设置,这样Xcode就会构建一个肥胖的通用二进制文件 http://useyourloaf.com/blog/2010/04/21/xcode-build-active-architecture-only.html

其他回答

在删除DerivedData- >Build- >Products- >Debug-iphoneos的内容后解决

当我在构建第二级框架时,我的“伞形框架”遇到了这个问题。

我通过改变我的第一个关卡框架的“通用iOS设备”构建方案来解决这个问题。我认为这将改变_CodeSignature,当我把我的整个“伞形框架”推到GitHub时,我看到了差异。

我通过检查右边目标成员中所选的实现文件来修复我的问题。这是非常有用的,特别是在处理扩展,即自定义键盘。

问题是cocoapods还没有为arm64架构构建,因此当你构建它们时,它们不能链接。在更新并使用该体系结构之前,您可能无法使用这些包。您可以通过进入项目->目标(您的项目名称)->构建设置并将架构更改为标准架构(armv7, armv7s),并将有效架构更改为armv7, armv7s来修复链接器错误。

Note though, this means you won't get the full power of the 64 bit processor. You said you are building for the 5s, so there may be some reason you need this. If you for some reason absolutely need that power (perhaps you are building a game), and desperately need those files, you could submit a pull request and then recompile the project to arm64 by setting those same fields to arm64 in the files you pulled from the open source projects. But, unless you really need these files to be 64 bit compatible, that seems like a bit of overkill for now.

编辑:有些人还报告说,将为活动架构构建设置为YES也是解决这个问题的必要条件。

截至2014-04-28,设置应该是这样的:

我有一部iPhone 5s,但还没有收到第三方库的64位版本,我不得不使用最新的Xcode回到32位模式(在5.1之前它没有抱怨)。

我通过从有效架构列表中删除arm64,然后将仅构建活动架构设置为NO来解决这个问题。在我看来,这比上面所示的其他方式更有意义。我写这篇文章是为了防止其他人无法得到上述任何一种解决方案。