【问题标题】:RN + Cocoapods = library not found for -lPods-XXXRN + Cocoapods = 找不到 -lPods-XXX 的库
【发布时间】:2020-03-10 11:08:43
【问题描述】:

我觉得这个问题已经被问了一遍又一遍,但我发誓我测试了互联网上看到的所有解决方案,但它仍在发生。

基本上,我将我的 React Native 项目转移到使用 cocoapods。请参阅下面的我的 Podfile。当我安装 pod 时,我将“libPods-XXX.a”添加到我的“Link Binary With Librairies”构建阶段。我猜这就是 Cocoapods 的工作原理?

但是当 libPods-XXX.a 在那里我无法构建时,总是得到错误“找不到 -lPods-XXX 的库”。如果我手动删除它,它工作正常。但是接下来的 pod install 会添加它。

我已经尝试过的:

  • 我正在使用工作空间文件
  • 对于 XXX 项目和安装的每个 pod,“仅构建活动架构”在调试中设置为是,在我的其他方案中设置为否。
  • 我的目标中的“其他链接器标志”设置为“$(inherited)”
  • 我的目标中的“库搜索路径”设置为“$(inherited)”
  • 已经尝试多次解体并重新安装,节点模块也是如此

我真的没有想法了。谁能指出我可能缺少的其他东西?

谢谢

播客文件

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

【问题讨论】:

    标签: ios xcode react-native mobile cocoapods


    【解决方案1】:

    回答我自己的问题:

    在我们的例子中,这个错误是由于我们在 Xcode 项目中有多个配置(暂存、生产、开发)。

    在构建设置中将$BUILT_PRODUCTS_DIR/../$CONFIGURATION-$PLATFORM_NAME 添加到我们目标的库搜索路径解决了这个问题!

    【讨论】:

      【解决方案2】:

      您是否在该字段中插入这一行?

      【讨论】:

        猜你喜欢
        • 2015-12-22
        • 2014-07-27
        • 1970-01-01
        • 2015-01-23
        • 1970-01-01
        • 2015-08-16
        • 2016-09-16
        • 2014-12-14
        • 2018-03-28
        相关资源
        最近更新 更多