I have an iOS/OS X Xcode projects, where I'm using CocoaPods, and I can't seem to figure out how to add my own project configurations (In addition to Debug and Release) without completely blowing up the build.
In the project, I have a number of targets, for apps on both platforms and its app extensions. The Xcode workspace of course also has the Pods project.
Because the project builds targets for iOS and Mac, I use CocoaPods "targets" to group their pods together. My Podfile looks something like this:
source 'https://github.com/CocoaPods/Specs.git' target :iOS do platform :ios, '7.1' link_with 'iOS', 'NozbeToday', 'NozbeShare', 'NozbeWatch' # pods... end target :Mac do platform :osx, '10.9' link_with 'Mac' # pods... end
Now here's where I have a problem. So far I've had only the default "Debug" and "Release" configurations in my project. I wanted to change them and add some new ones for different provisioning profile/bundle ID combination.
… and I'm stuck. I can't figure out how to do this.
First sign of the problem was a warning pod install
spewed out for every target/configuration combination:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
NozbeToday
toPods/Target Support Files/Pods-iOS/Pods-iOS.dev debug.xcconfig
or include thePods/Target Support Files/Pods-iOS/Pods-iOS.dev debug.xcconfig
in your build configuration.
I couldn't figure out what it means and how to fix this. Either way, the project wouldn't build — in the best case scenario I would get a linker error saying that it can't find Pods-something.a
…
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. Click the + button at the top and choose Add User-Defined Setting.
OK, so half-way through writing this question I figured it out myself (yay rubber ducking). Here's the solution for next generations:
Essentially, you have to add an explicit dependency on the Pods target to your application scheme.
The way you do it, is: edit your application scheme, go to the Build section, and add the Pods target above your application target. You should see something like this:
And it will just work.
As for the CocoaPods warnings on pod install
, you need to use the xcconfig
files generated by CP for each of your Xcode configurations. The way you do it is:
Pods/Target Support Files
You'll also need something like this in your Podfile to let CocoaPods know which of your Xcode configurations are "debug" (unoptimized), which are "release":
project '1Nozbe', { 'iOS 1 Dev Debug' => :debug, 'iOS 2 Dev AdHoc' => :release, 'iOS 3 Release Debug' => :debug, 'iOS 4 Release AdHoc' => :release, 'iOS 5 Release AppStore' => :release, }
Not exactly related to CocoaPods, but if you happen to have some other (sub-project) dependencies other than CP, you'll also need to do two things:
Add this line in your config file, just like import a header file:
#include "Pods/Target Support Files/Pods/Pods.debug.xcconfig"
NOTE: it's #include
, not #import
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