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?