Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 533
wheresmycookie Avatar asked Sep 21 '16 20:09

wheresmycookie


People also ask

How do I change the configuration of Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.

What is Xcconfig file in Xcode?

A xcconfig file is used as a supplemental file to a specific build configuration. A build configuration can have an associated xcconfig file, this allows for additional changes to the target's build settings from outside the Xcode project editor.

How do I manage schemes in Xcode?

To view and modify your project's current schemes, select Manage Schemes. For example, disable automatic creation of schemes for new targets, and change scheme attributes such as which project contains the scheme. By default, Xcode shares schemes with other team members.


1 Answers

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)

like image 91
Ben Clayton Avatar answered Oct 22 '22 08:10

Ben Clayton