10

A new XCode project has Debug and Release Configurations. I've added a new one under "ProjectName > Info" called "development", which is for now a duplicate of "debug".

I wanted to create a new scheme for building the app in development mode, so I duplicated the "Projectname" scheme and named it "DevelopmentScheme".

I set the build configuration for "run" and "archive" to the new "development" configuration that I created.

I'm still able to build the original Scheme.

I'm also able to build all of the required libraries when the project is configured with the development scheme, but when I get to the linking phase, I get the error:

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

Being relatively new to iOS development, I'm not really sure what the issue could be. Since I duplicated everything, shouldn't that mean they behave in the same way? Thoughts on what might be different between the original and new schemes?

2 Answers 2

27

The problem is that Xcode will expect to find the libraries inside a folder named after your custom configuration. You can add the custom configuration to each library you use, or better follow the steps below to make it use the libraries built via the Release configuration.

Steps:

  • Select your target
  • Open Build Settings tab
  • Search for 'Library Search Paths'
  • You'll see your new configuration name alongside Debug and Release
  • Double-click the space next to your new configuration name
  • Enter "$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)"
  • Set recursive to true.

enter image description here

  • Exit the dialog and you should see:

enter image description here

(inspired by this post)

3
  • 2
    Thanks for the inspiration. I was building a react-native project and what I did was to change both Per-configuration Build Products Path and Per-configuration Intermediate Build Files Path to $(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME). Took me hours, thanks Xcode. Mar 27, 2017 at 8:03
  • Perfect - This fixed the issue where adding a new scheme was breaking things. Maybe react-native should add a 'new-scheme' CLI cmd which would do all this for us (not that there's much there - but later down the track more things may be required)
    – James111
    Apr 26, 2017 at 3:51
  • For people who are struggling with react-native project, I found this guide quite useful: github.com/microsoft/react-native-code-push/blob/master/docs/…. Also checkout this document regarding the new changes in XCode 11, and if you also have pod dependencies: github.com/microsoft/react-native-code-push/issues/1782
    – Wing
    Jun 8, 2020 at 3:58
9

Xcode 8.3.2 needs a bit different changes.

To make it work, you need to change the Per-configuration Build Products Path for your custom build config. For example, I have an Internal build config. In that field, instead of $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME), I put $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME), and now it works :).

4
  • Edits have to be more than 6 charachters and this it's a measly one char correction: It's Per-configuration Build Products Path :)
    – jonasl
    Jun 21, 2017 at 6:40
  • Did you ever encounter the issue with, "Make sure you're running a packager server or have included a .jsbundle file in your application bundle." ?
    – TomTom
    Aug 7, 2017 at 9:18
  • yea.. i just stop and start the packager and the project. it doesnt happen that often to annoy me enough to try to fix it. i know thats bad, but i need to fix other stuff before that.
    – pvinis
    Aug 7, 2017 at 12:59
  • 1
    Tried your solution....but the problem I face is all schemes are building in single folder(release) inside ~/Library/...../Build/Products folder....Is it possible for different builds to be present in different folders based on the selected scheme and link the library successfully? Please help Aug 8, 2018 at 19:57

Your Answer

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

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