ios - Apple Mach-O 链接器错误 - 架构 x86_64 的未定义符号
问题描述
以前我使用的是 Xcode 9.2,我只能构建到模拟器。构建到设备将导致苹果匹配 O 链接器错误。
现在我将 Xcode 更新到 9.4.1,我无法再构建到模拟器/设备。我得到了苹果匹配 O 链接器错误,如下所示:
Undefined symbols for architecture arm64:
"type metadata for Foundation.NSFastEnumerationIterator", referenced from:
type metadata accessor for Swift.EnumeratedIterator<Foundation.NSFastEnumerationIterator> in TableForm.o
"Swift.FloatingPointSign.rawValue.getter : Swift.Int", referenced from:
MyApp.TableForm.heightForView(Swift.String, font: __ObjC.UIFont, width: CoreGraphics.CGFloat) -> CoreGraphics.CGFloat in TableForm.o
MyApp.MultilineCell.textViewDidChange(__ObjC.UITextView) -> () in MultilineCell.o
"(extension in Swift):Swift.Collection< where A.Element: Swift.Equatable>.split(separator: A.Element, maxSplits: Swift.Int, omittingEmptySubsequences: Swift.Bool) -> [A.SubSequence]", referenced from:
MyApp.TableForm.tableView(__ObjC.UITableView, cellForRowAt: Foundation.IndexPath) -> __ObjC.UITableViewCell in TableForm.o
.....
.....
(其中很多,检测到 200 多个错误)而且都与 Swift 的标准库/功能/类型有关。例如:
"Swift.Array.remove(at: Swift.Int) -> A",
"Swift.FloatingPointSign.rawValue.getter : Swift.Int",
“Swift.Array.removeAll(keepingCapacity: Swift.Bool) -> () 的泛型特化”,
"Swift.min(A, A, A, A...) -> A",
“静态 Swift.String.+ 中缀(Swift.String,Swift.String)-> Swift.String”`
到目前为止我已经尝试过:
- 删除派生数据内容。
- 更新 Pod。
- 检查 Build Phases -> Compiled Sources 以获取所需的每个文件(需要的 swift 和 objc 类/对象)。
这些都没有帮助解决这个问题。想知道是否有人可以帮助我解决这个问题?
编辑:不确定这是否相关,但我也收到了这些警告:
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreAudio.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreMedia.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftAVFoundation.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftSwiftOnoneSupport.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCore.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftQuartzCore.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreImage.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreGraphics.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftMetal.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftsimd.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftFoundation.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftDispatch.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftObjectiveC.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreFoundation.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftCoreData.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftUIKit.dylib (2 slices)
ld: warning: Auto-Linking missing required architecture arm64 in file build/MyApp.app/Frameworks/libswiftDarwin.dylib (2 slices)
解决方案
推荐阅读
- java - 如何在终端中使用 .jar 文件?
- debugging - 如何自己重写烧瓶调试重新加载规则?
- sql - 使用 *typed* XML 从父节点读取属性时出现 XQuery 错误(value() 需要单例)
- cassandra - 节点工具修复命令是修复集群中的所有节点还是修复执行命令的单个节点?
- java - Log4j2 中是否使用了 java 本机内存?我发现许多登录本机内存而不是堆
- sql - 我可以在 mariaDB 中的视图上添加索引吗
- reactjs - ^C: 这并没有给我我的命令,我该怎么办?
- javascript - 带有 Node js 承诺链的 for 循环
- c# - Xamarin.Forms Scrollview 不会滚动
- c# - 如何排除需要身份验证的特定控制器操作?