简体   繁体   中英

RN + Cocoapods = library not found for -lPods-XXX

I feel this question have been asked again and again but I swear I tested every solution seen on the internet and it's still happening.

Basically I moved my React Native project to using cocoapods. See my Podfile below. When I pod install I get added "libPods-XXX.a" to my "Link Binary With Librairies" build phase. I guess that's how Cocoapods works?

But when libPods-XXX.a is there I can't build, always get the error "library not found for -lPods-XXX". If I remove it manually it works fine. But then next pod install will add it.

What I tried already :

  • I am using worskspace file
  • "Build Active Architecture Only" is set to Yes in Debug, no in my other Schemes, for the XXX project and for every pods installed.
  • "Other linker flags" in my target is set to "$(inherited)"
  • "Library search path" in my target is set to "$(inherited)"
  • Already tried to deintegrate and resinstall multiple times, same goes for node modules

I am really running out of ideas here. Can anyone point me to something else I might be missing?

Thanks

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

Answering my own question :

In our case this error was due to us having multiple configurations (staging, production, development) in our Xcode project.

Adding $BUILT_PRODUCTS_DIR/../$CONFIGURATION-$PLATFORM_NAME to Library Search Path of our Target in Build Settings solved the issue!

打印

Do you insert this line within that field?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM