所以标题说,我试过两个Xcode版本,但仍然没有运气。这是我得到的错误:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RCTCxxBridge", referenced from:
objc-class-ref in libReact.a(RCTBridge.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我试过了:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Absent' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Absent
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/'
pod 'React', path: '../node_modules/react-native', :subspecs => [
'RCTGeolocation',
'RCTNetwork',
'Core',
'DevSupport',
'BatchedBridge',
'RCTAnimation',
'RCTText',
'RCTWebSocket'
]
target 'AbsentTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'Absent-tvOS' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Absent-tvOS
target 'Absent-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
RCTCxxBridge
和CxxBridge
而不是BatchedBridge,因为它被认为已被弃用但仍然没有运气......任何指针都会在这里受到赞赏:)
因此,根据评论,显然这是以前失败的构建缓存,这会搞乱我的归档过程。我所要做的就是删除node_modules
,ios/builds
和ios/Pods
然后再次做npm install
,react-native link
和cd ios && pod install
,项目一切都很好。
之后我得到duplicate symbols on arm64
错误,这只是因为react-native
和RCTWebSocket
都有一些重叠的类。所以要解决这个问题,我只需要从XCode的General选项卡上的Project的libRCTWebSocket.a
info子类别中删除Linked Frameworks and Libraries
。
特别感谢@needsleep的解决方案!