I've setup cocoapods for my project and I've been doing development for quite some time without any issues. Recently I added a new Configuration for it called "Beta", duplicating the "Release" configuration. At the same time, I added a Scheme that would build targets using this configuration.
This new scheme would build everything without issues, but linking would fail with the (quite known it seems) message:
ld: library not found for -lPods
I know that issues that makes this error message come up have been discussed widely around the web, with different causes and conditions:
None of these fixes seem to apply here. What I can see by looking into the workspace folder, is that Cocoapods build products are put in Build/Products/Release-iphonesimulator
instead of in Build/Products/Beta-iphonesimulator
, even though the app itself is built rightly so into the latter. Moving all the *.a
files into Build/Products/Beta-iphonesimulator
makes running in the simulator work properly, but the next build is still put in the wrong location.
After some further investigations, the environment variable $BUILT_PRODUCTS_DIR
is set correctly in the build phase for the app itself, but not when building cocoapods products.
What causes this and how can I fix this?
pod install
has been run, multiple timesFor the record, the issue has been solved. So, as I said, I use cocoapods, but my current setup is that a single podfile, and workspace is used for 3 projects that share some common libraries. As explained in this issue, cocoapods will only consider one project out of all those that are specified in the podfile, and it turns the one project (out of three) that it was using, didn't have the beta
configuration, so it didn't feel the need to prepare for it. So when it was time to build the project with the beta
configuration, cocoapods would be built for the release
configuration, and put in some folder specific to release
, so the beta
project wouldn't be able to find it.
Fixing was a matter of creating the beta
configuration for all projects present in the workspace, forcing cocoapods to prepare accordingly. Then, Xcode would be able to wire up everything appropriately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With