Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

When attempting to run React-Native app on ios device, why are all RCT... references "undefined symbol" errors?

$
0
0

I'm trying to run my first React-Native app on a device but the build always fails with the following error:

ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'

ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'

ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'

ld: warning: ignoring file /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/build/nigh/Build/Products/Debug-iphonesimulator/React/libReact.a, file was built for archive which is not the architecture being linked (arm64): /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/build/nigh/Build/Products/Debug-iphonesimulator/React/libReact.a

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RCTBridge", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTConvert", referenced from:
      objc-class-ref in libRNGestureHandler.a(RNFlingHandler.o)
      objc-class-ref in libRNGestureHandler.a(RNForceTouchHandler.o)
      objc-class-ref in libRNGestureHandler.a(RNLongPressHandler.o)
      objc-class-ref in libRNGestureHandler.a(RNNativeViewHandler.o)
      objc-class-ref in libRNGestureHandler.a(RNPanHandler.o)
      objc-class-ref in libRNGestureHandler.a(RNGestureHandlerModule.o)
      objc-class-ref in libRNGestureHandler.a(RNGestureHandler.o)
      ...

React directory not found error

A few things up front:

The project runs fine on the XCode emulator.

I am using cocoapods and am trying to run the build from the xcWorkspace instead of project (though the full path of the target is /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/nigh.xcodeproj which confuses me a little).

I've removed and reinstalled node-modules, linked, and done new pod installs.

It looks like all I have to do is add React to the Debug-iphoneos folder, but I'm not sure how to do that or if that's the solution. My first attempt was to make sure React was in the Scheme's Build Targets. It was the first on the list with all boxes checked, except for some reason it said React(missing). Per React Native / Xcode Upgrade and now RCTConvert.h not found I removed React(missing) from the Targets list and attempted to add React again, but React does not even show up in the list. Also, the Pods/Products folder shows libReact.a differently than the other .a files, without the Archive(?) icon:

List of Pod/Products

Here's the podfile:


require_relative '../node_modules/react-native-unimodules/cocoapods'

target 'nigh' do
  # Pods for nigh
  use_frameworks!

    # pod 'AWSCore', '~> 2.12.0'
    pod 'AWSCore', '~> 2.10.2'
    pod 'AWSAppSync', '~> 2.14.2'

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
  pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
  pod 'react-native-google-maps', path: '../node_modules/react-native-maps'  # Uncomment this line if you want to support GoogleMaps on iOS
  pod 'GoogleMaps'  # Uncomment this line if you want to support GoogleMaps on iOS
  pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS

  use_unimodules!


  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'react-native-maps', :path => '../node_modules/react-native-maps'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'

  pod 'react-native-notifications', :path => '../node_modules/react-native-notifications'

  pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll'

  pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'

  pod 'RNFS', :path => '../node_modules/react-native-fs'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end

    #if target.name == "React"
    #  target.remove_from_project
    #end
  end
end

I commented out the if target.name == "React" block, but the error shows up either way.

Am I right in assuming the problem is that React is not in the scheme's build targets, and if so does anyone know how to include it? If not, does anyone know what the real cause could be/how to fix/work around it?


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>