RN + Cocoapods =找不到-lPods-XXX的库

时间:2020-03-10 11:08:43

标签: ios xcode react-native mobile cocoapods

我觉得这个问题已经被问过一次又一次,但是我发誓我测试了互联网上出现的所有解决方案,而且这种情况仍在发生。

基本上,我将我的React Native项目转移到使用cocoapods。请参阅下面的我的Podfile。当我进行pod安装时,我将“ libPods-XXX.a”添加到“使用Librairies链接二进制文件”构建阶段。我猜这就是可可豆的工作原理吗?

但是当libPods-XXX.a存在时,我无法构建,总是出现错误“找不到-lPods-XXX的库”。如果我手动将其删除,则效果很好。但是随后下一个pod安装将添加它。

我已经尝试过的东西:

  • 我正在使用worskspace文件
  • 对于XXX项目和安装的每个Pod,在Debug中将“仅构建Active Architecture”设置为“是”,在我的其他Scheme中设置为“否”。
  • 目标中的“其他链接器标志”设置为“ $(继承)”
  • 目标中的“库搜索路径”设置为“ $(继承)”
  • 已经尝试多次分解和重新安装,节点模块也是如此

我的想法真的耗尽了。谁能指出我可能会想念的其他东西?

谢谢

Podfile

platform :ios, '9.0'

target :XXX do
    pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
    pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
    pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
    pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
    pod 'React', :path => '../node_modules/react-native/'
    pod 'React-Core', :path => '../node_modules/react-native/'
    pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
    pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
    pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
    pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
    pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
    pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
    pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
    pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
    pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
    pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
    pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
    pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

    pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
    pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
    pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
    pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
    pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
    pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
    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'

  # Pods for XXX
  pod 'react-native-signature-capture', :podspec => '../node_modules/react-native-signature-capture/react-native-signature-capture.podspec'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
  pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
  pod 'RNI18n', :path => '../node_modules/react-native-i18n'
  pod 'SentryReactNative', :path => '../node_modules/react-native-sentry'
  pod 'react-native-version-number', :path => '../node_modules/react-native-version-number'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'react-native-background-upload', :path => '../node_modules/react-native-background-upload'
  pod 'react-native-document-picker', :path => '../node_modules/react-native-document-picker'
  pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
end

2 个答案:

答案 0 :(得分:0)

回答我自己的问题:

在我们的案例中,此错误是由于我们在Xcode项目中具有多个配置(阶段,生产,开发)造成的。

在构建设置中将$BUILT_PRODUCTS_DIR/../$CONFIGURATION-$PLATFORM_NAME添加到目标的库搜索路径中!

答案 1 :(得分:-2)

print

您将此行插入该字段吗?