每次我从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


当前回答

这个链接错误消息表明定义它的源文件没有被标记为应用程序目标的一部分。找到源文件,并使用右边的file属性检查器来检查应用程序目标的目标成员条目。

解决方案: 选择文件-> openFile Inspector ->参见目标成员->检查如果未选中目标您的运行目标

其他回答

转到目标构建设置。 为调试和发布设置BUILD ACTIVE ARCHITECTURE ONLY = NO 构建并运行

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

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

你只需要从有效架构中删除arm64,并将NO设置为仅活动架构。现在只需要清洁、构建和运行。您将不会再次看到此错误。

:) KP

没有解决方案修复这个错误在我的情况下(Xcode 9),与TesseractOCRiOS。经过几个小时的反复试验,我想出了一个很好的解决办法。我只是删除Podfile中的'pod 'TesseractOCRiOS', '~> 4.0.0',运行pod install。然后,将pod 'TesseractOCRiOS', '~> 4.0.0'添加回Podfile,并再次运行pod install。

砰!它的工作原理!

问题是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,设置应该是这样的: