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


当前回答

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

其他回答

我知道这是一个古老的分支。然而,在迁移到最新的CocoaPods版本(1.0.0)并试图重新安装所有pod后,同样的问题开始发生在我身上。我遇到了“armv64缺失符号”链接错误。 奇怪的是,我通过以下步骤解决了这个问题:

删除所有pod (pod init, 舱安装) 以相反的顺序重写podfile(而不是: 豆荚“Mixpanel年”, 豆荚“对讲机”, 我使用: 豆荚“对讲机”, 豆荚”“Mixpanel ) 圆荚体安装

颠倒podfile中依赖关系的顺序并重新构建pods解决了这个问题。

我遇到了相同/类似的问题,实现AVPictureInPictureController,问题是我没有在我的项目中链接AVKit框架。

错误信息是:

Undefined symbols for architecture armv7:
   "_OBJC_CLASS_$_AVPictureInPictureController", referenced from:
       objc-class-ref in yourTarget.a(yourObject.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案:

进入你的项目 选择目标 然后,转到构建阶段 用库打开二进制链接 最后,只需添加+ AVKit框架/任何其他框架。

希望这能帮助其他遇到类似问题的人。

我也遇到过同样的问题,以上的方法都行不通。我不小心删除了下面目录下的文件。

文件夹位置:

~ /图书馆/开发/ Xcode / DerivedData /

如果你在发布模式(或存档)构建时遇到这个问题,请查看我的这个答案:https://stackoverflow.com/a/61446892/5502121 长话短说:

在文件>项目设置中将构建系统设置为新建构建系统… 删除ios和build_ios文件夹 运行flutter create。初始化新的ios模块 运行pod安装 跑扑酒吧得到 检查你的Xcode构建配置(它应该是发布模式和通用iOS设备)

你可以开始了

我在升级到Xcode 5.1后也遇到了同样的问题,并通过将架构设置为armv7 armv7s来解决它