首页 > 解决方案 > 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”`

到目前为止我已经尝试过:

这些都没有帮助解决这个问题。想知道是否有人可以帮助我解决这个问题?

编辑:不确定这是否相关,但我也收到了这些警告:

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)

标签: iosswiftxcode

解决方案


推荐阅读