Why is React(missing) in xcode scheme build targets list?
Asked Answered
A

1

9

I'm trying to run my first React-Native app on an ios device using xcode and keep getting this error:

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

ld: library not found for -lReact
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm assuming the cause is related to the fact that React is missing in my Scheme's build targets list. React is first on the list with all the boxes checked, but it says React(missing) instead of just React:

Screenshot of build targets list

If I click the '+' button React is not an option. Here is my podfile:

platform :ios, '10.0'

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

target 'nigh' do
  # Pods for nigh
  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've tried removing the if target.name == "React" block and still get the same error. I'm also opening xcode from .xcworkspace instead of .xcodeproject since I am using cocoapods. I've tried removing everything from the DerivedData folder and cleaning the build, and have also tried building using the Legacy Build System. The Legacy Build system shows warnings on nearly every library that read "Missing dependency target 'React'".

I needed to change my bundle name from org.reactjs.native.example.nigh to org.reactjs.native.name.nigh, so could that be responsible? I know that at some point React was not missing in the targets list. Despite React missing the app still runs fine on the xcode iphone emulator.

Also in the Pods/Products file libReact.a does not have an icon like the other .a files do

Can anyone tell me why this is happening and/or how to fix/work around it?

Amperage answered 8/11, 2019 at 12:7 Comment(6)
If you are using the latest React Native, Podfile should not look like that. See update helper.Teetotaler
I'm using 0.59.10. Is there no way to run the project on a device using this version, or do I need to update and change all my files?Theresiatheresina
My Product -> Edit scheme shows as React Missing. Any solution for this?Role
I think the issue was really related to using Expo, since Expo doesn't seem to use the latest version of react native (thanks @Ziyo). It also requires more fiddling in the long run and is missing some native functionality, so in the future unless what I'm building is nice and lightweight I'm going to avoid Expo. I ended up creating a new project with react native cli and everything runs like clockwork. For those wanting to try my solution, restarting sans Expo, select React Native Cli Quickstart on [facebook.github.io/react-native/docs/getting-started]Theresiatheresina
I'm getting this error, and my podfile is the updated one.Pericranium
@Bend'Straw have you managed to solve this? Any update?Cerumen
Y
-4

I fixed this issue by going System Preferences -> Security & Privacy. Under the privacy tab I allowed Xcode to access my files and folders.

What actually happened was that I upgraded my OS to Catalina. Somehow the access to files and folder is not granted to Xcode, hence xcode is not able to read the file and so you get this issue.

Settings pane for Security and Privacy

Yorgen answered 8/1, 2020 at 6:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.