我正在尝试在配备 Apple M1 芯片组的 Mac Mini 中运行 React Native 应用程序。该项目在基于 Intel 的系统上运行良好,但在 M1 上运行不佳。当我构建时,出现以下错误。
Undefined symbol: nominal type descriptor for Swift.UInt8
Undefined symbol: nominal type descriptor for Swift._ContiguousArrayStorage
Undefined symbol: _swift_deletedMethodError
Undefined symbol: __swift_FORCE_LOAD_$_swiftsimd
Undefined symbol: _swift_deallocObject
Undefined symbol: _swift_getObjCClassMetadata
Undefined symbol: __swift_FORCE_LOAD_$_swiftAVFoundation
Undefined symbol: Swift.String.count.getter : Swift.Int
Undefined symbol: (extension in Foundation):Swift.StringProtocol.cString(using: (extension in Foundation):Swift.String.Encoding) -> [Swift.Int8]?
Undefined symbol: Foundation.Data._Representation.replaceSubrange(_: Swift.Range<Swift.Int>, with: Swift.UnsafeRawPointer?, count: Swift.Int) -> ()
Undefined symbol: type metadata accessor for Foundation.__DataStorage
Undefined symbol: type metadata accessor for Foundation.Data.RangeReference
Undefined symbol: Swift.Hasher.init(_seed: Swift.Int) -> Swift.Hasher
Undefined symbol: Swift.String.hash(into: inout Swift.Hasher) -> ()
Undefined symbol: Swift.Hasher._finalize() -> Swift.Int
Undefined symbol: Foundation._convertNSErrorToError(__C.NSError?) -> Swift.Error
Undefined symbol: static (extension in ObjectiveC):__C.NSObject.== infix(__C.NSObject, __C.NSObject) -> Swift.Bool
Undefined symbol: static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String
Undefined symbol: _swift_beginAccess
Undefined symbol: static (extension in Foundation):Swift.Dictionary._unconditionallyBridgeFromObjectiveC(__C.NSDictionary?) -> [A : B]
Undefined symbol: _swift_getTypeByMangledNameInContextInMetadataState
Undefined symbol: __swiftEmptyDictionarySingleton
Undefined symbol: _swift_bridgeObjectRetain
Undefined symbol: Swift._StringGuts.grow(Swift.Int) -> ()
Undefined symbol: nominal type descriptor for Swift.AnyHashable
Undefined symbol: static Swift._DictionaryStorage.allocate(capacity: Swift.Int) -> Swift._DictionaryStorage<A, B>
Undefined symbol: Swift.String.append(Swift.String) -> ()
Undefined symbol: protocol witness table for Swift.AnyHashable : Swift.Hashable in Swift
Undefined symbol: _swift_initStackObject
Undefined symbol: _swift_getWitnessTable
Undefined symbol: (extension in Foundation):Swift.Dictionary._bridgeToObjectiveC() -> __C.NSDictionary
Undefined symbol: protocol witness table for Swift.String : Swift.Hashable in Swift
Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreImage
Undefined symbol: __swiftEmptyArrayStorage
Undefined symbol: Swift.KEY_TYPE_OF_DICTIONARY_VIOLATES_HASHABLE_REQUIREMENTS(Any.Type) -> Swift.Never
Undefined symbol: Foundation.NSLog(Swift.String, Swift.CVarArg...) -> ()
Undefined symbol: _swift_bridgeObjectRetain_n
Undefined symbol: (extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString
Undefined symbol: _swift_bridgeObjectRelease
Undefined symbol: Foundation.Data._bridgeToObjectiveC() -> __C.NSData
Undefined symbol: _swift_allocObject
Undefined symbol: static (extension in Foundation):Swift.String.Encoding.utf8.getter : (extension in Foundation):Swift.String.Encoding
Undefined symbol: Swift._HashTable.previousHole(before: Swift._HashTable.Bucket) -> Swift._HashTable.Bucket
Undefined symbol: _swift_initStaticObject
Undefined symbol: protocol conformance descriptor for Swift.String : Swift.StringProtocol in Swift
Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType
Undefined symbol: type metadata for Swift.String
Undefined symbol: Swift._stringCompareWithSmolCheck(_: Swift._StringGuts, _: Swift._StringGuts, expecting: Swift._StringComparisonResult) -> Swift.Bool
Undefined symbol: type metadata for Swift.AnyHashable
Undefined symbol: (extension in Foundation):Swift.Error.localizedDescription.getter : Swift.String
Undefined symbol: nominal type descriptor for Swift.CollectionOfOne
Undefined symbol: _swift_isUniquelyReferenced_nonNull_native
Undefined symbol: __swift_FORCE_LOAD_$_swiftUIKit
Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation
Undefined symbol: value witness table for Builtin.UnknownObject
Undefined symbol: method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreAudio
Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral
Undefined symbol: _swift_dynamicCast
Undefined symbol: protocol conformance descriptor for <A where A == Swift.UInt8> Swift.CollectionOfOne<A> : Foundation.ContiguousBytes in Foundation
Undefined symbol: value witness table for Builtin.Int32
Undefined symbol: type metadata accessor for (extension in Foundation):Swift.String.Encoding
Undefined symbol: _swift_retain
Undefined symbol: __swift_FORCE_LOAD_$_swiftMetal
Undefined symbol: Swift.AnyHashable._rawHashValue(seed: Swift.Int) -> Swift.Int
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics
Undefined symbol: type metadata for Any
Undefined symbol: protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift
Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation
Undefined symbol: _swift_getForeignTypeMetadata
Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A
Undefined symbol: nominal type descriptor for Swift._DictionaryStorage
Undefined symbol: static Swift._DictionaryStorage.copy(original: Swift.__RawDictionaryStorage) -> Swift._DictionaryStorage<A, B>
Undefined symbol: _swift_willThrow
Undefined symbol: _swift_endAccess
Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC
Undefined symbol: _swift_errorRelease
Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift
Undefined symbol: _swift_getTypeByMangledNameInContext
Undefined symbol: (extension in Foundation):Swift.Array._bridgeToObjectiveC() -> __C.NSArray
Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreMedia
Undefined symbol: Foundation.__DataStorage.init(capacity: Swift.Int) -> Foundation.__DataStorage
Undefined symbol: __swift_FORCE_LOAD_$_swiftQuartzCore
Undefined symbol: _swift_release
Undefined symbol: static Swift._DictionaryStorage.resize(original: Swift.__RawDictionaryStorage, capacity: Swift.Int, move: Swift.Bool) -> Swift._DictionaryStorage<A, B>
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral
Undefined symbol: _swift_getErrorValue
Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin
我该如何解决这个问题。我已经尝试添加 Swift 文件和桥接文件。但这不起作用。请帮助我
Xcode版本:13.0, 反应本机版本:0.64.2, iOS模拟器15, Mac 操作系统:11.4,
对于那些仍然遇到此问题的人,您可以尝试以下方法,因为它对我有用:
原帖链接:https://dev.to/mngyuan/updating-react-native-projects-for-m1-mac-development-1mk4
我们将从我们的构建中排除arm64架构。在“目标”下,选择您的项目 -> 构建设置 -> 排除的架构,然后为调试和发布添加任何 IOS 模拟器 SDK:arm64。对您的 Pods 项目执行相同的操作。
如果您的项目由于某种原因设置了 VALID_ARCHS,则在此阶段您还需要从项目(以及 Pods 项目)中删除该密钥。 我们已经非常接近完成了,但是您的 Pod 中安装的 Flipper 版本可能不够新,无法包含针对 M1 Mac 的修复。打开 ios/Podfile 并应用以下内容
并更新您的 Pod
cd ios/
pod更新
如果您执行的构建失败,您可能需要像这样清除 DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/
自从运行react-native 0.64以来,我还必须将其添加到我的pod文件中
未定义符号:CoreGraphics.CGFloat 的标称类型描述符
未定义符号:CoreGraphics.CGFloat的类型元数据
未定义符号:CoreGraphics.CGFloat 的协议一致性描述符:CoreGraphics 中的 Swift.Comparable
升级到 Xcode 16 后遇到上述类似错误的用户可以按照以下解决方案:
1。转到构建阶段
2。将库添加到“链接二进制与库”:
3.清理并重建项目: