wheresmycookie wheresmycookie - 17 days ago 7
iOS Question

Created new XCode Configuration and Scheme - linker is suddenly failing

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?

Answer

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)

Comments