简体   繁体   中英

React Native: Building for IOS failed on XCode 9.2 and 9.4 and RN 55.4

So as the title said, I tried on both Xcode versions and still no luck. This is the error I'm getting:

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)

I've tried:

  • following these suggestions here
  • cleaning the project between builds
  • restarting XCode and the mac itself
  • adding modifications to podfile like so:

     # 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 
  • Tried using RCTCxxBridge and CxxBridge instead of BatchedBridge because it's supposedly deprecated

But still no luck... Any pointers would be appreciated here :)

So based on the comment, apparently it's the previous failed builds cache that's messing up my archiving process. All I had to do was to delete node_modules , ios/builds and ios/Pods then do npm install , react-native link and cd ios && pod install once again and the project was all good.

After that I was getting duplicate symbols on arm64 error which was simply because both react-native and RCTWebSocket have some overlapping classes. So to solve that I just have to delete libRCTWebSocket.a from Project's Linked Frameworks and Libraries info subcategory on General tab from XCode.

Special thanks to @needsleep for the solution!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM