我正在尝试使用xcode在ios设备上运行我的第一个React-Native应用程序,并不断出现此错误:
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)
我假设原因与我的方案的构建目标列表中缺少React的事实有关。在所有选中的复选框中,React排在第一位,但是它说React(missing)而不是React:
Screenshot of build targets list
如果我单击“ +”按钮,则无法选择React。这是我的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
我尝试删除if target.name ==“ React”块,但仍然遇到相同的错误。由于我正在使用cocoapods,因此我也从.xcworkspace而不是.xcodeproject打开xcode。我尝试从DerivedData文件夹中删除所有内容并清理构建,并且还尝试使用旧版构建系统进行构建。旧版生成系统几乎在所有读取“缺少依赖目标'React'”的库上显示警告。
我需要将包名称从org.reactjs.native.example.nigh更改为org.reactjs.native.name.nigh,所以这可以负责吗?我知道在某些时候,React在目标列表中并不缺少。尽管缺少React,但该应用程序仍可以在xcode iphone模拟器上正常运行。
Also in the Pods/Products file libReact.a does not have an icon like the other .a files do
有人可以告诉我为什么会这样和/或如何解决/解决它吗?