9

Having a react-native project, which won't build on target "Staging" since I've setup cocoapods and using xcworkspace file since then (needed for firebase integration of react-native-firebase). When trying to build for taget "staging", I'll get this error:

ld: library not found for -lPods-[app]
clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

It works on debug, and (well at least it doesn't throw an error) when I archive the project.

I've having a "staging" target because of code-push. Using react-native at version 0.48.4 and Xcode 9 (created it following this guide, but before using cocoapods)

My podfile:

platform :ios, '9.0'

target 'xx' do
  #use_frameworks!

  # Pods 
  pod 'Firebase/Core'
  pod 'Firebase/Analytics'
  pod 'Firebase/Database'
  pod 'Firebase/Messaging'
  pod 'Firebase/Auth'
  pod 'Firebase/Storage'

end

Tried with and without use_frameworks!, cleaning project, deleted DerivedData, deintegrating and reintegrating pods.

What could cause this? (Please tell me if you need more information)

4
  • Go to Build Phases and check if the framework is added in the “Link Binary with Libraries” tab
    – Maurice
    Commented Jan 12, 2018 at 15:00
  • 1
    It is (libPods-[projectName].a with status required)
    – Dennis
    Commented Jan 12, 2018 at 15:01
  • Set $(inherited) in the Library Search Paths. If that does not work you can try to set "Build Active architecture Only" to YES
    – Maurice
    Commented Jan 12, 2018 at 15:06
  • I have already $(inherited) on all targets (in the project column). Can you tell me how I should set "Build Active Architecture Only" properly? I'm having columns: "Resolved" (not editable, says "YES" on debug, empty on Release/Staging), [Target], Config.file (not editable), [Project]. Tried it with same values as debug has (setting [Target] to YES), cleaned and rebuild, but still fails.
    – Dennis
    Commented Jan 12, 2018 at 15:34

4 Answers 4

15

What worked for me:

  1. Deintegrated all pods using pod deintegrate (using enter link description here)
  2. pod install
  3. Removed [Project name] > Frameworks > Pods_[Project name].framework (which was red, but there are actually more files being red)
  4. Build succeeded

Was doing this with the help of this post. Thanks also to Maurice for trying to help me.

1
  • 1
    After each pod install i need to do Removed [Project name] > Frameworks > Pods_[Project name].framework is it possible to do it automatically because i have issue in CI
    – ButuzGOL
    Commented Nov 19, 2018 at 10:48
3

I had this issue. In my case it was a react-native app added Firebase Analytics. As of July 2018, all apps must be built with iOS 11 per Apple: developer.apple.com/ios/submit/

Once I went to my General tab and scrolled down to Deployment Info / Deployment Target and changed it from 10.x which is what I was targeting, to 11.x - the app built/archived and I was able to submit.

2
  • 2
    This worked for me. Strange because my project was building fine today. (I hadn't built it in a few months ) but started failing when I tried adding another pod and failed even when I reset, clean project and temp files but setting from 9.3 to 11 worked. Commented Nov 20, 2018 at 20:33
  • btw: After successful build I changed it back to 9.3 just to test. It works in dev. I'll see about submitting to the store. Commented Nov 20, 2018 at 20:47
1
  1. Set your PODS_CONFIGURATION_BUILD_DIR of "staging" as "release" ${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME).

  2. Check the Frameworks folder and remove red files.

0

check whether the SEARCH_PATHS is correct at Pods-XXXX.debug.xcconfig or Pods-XXXX.release.xcconfig

enter image description here

LIBRARY_SEARCH_PATHS = $(inherited) "$(PODS_ROOT)/path/to/your folder"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.