smartwolf smartwolf - 1 year ago 86
Objective-C Question

How to add lite & pro version of library via CocoaPods?

I have my own static library which has two versions - lite & pro.

It's in private repo.

I've added separate private Podspec for each version.

Libs are as compiled static .a files with header files (not open source).

Adding to project like this:

# common cocoapods stuff here

abstract_target 'CommonPods' do

# some other pods here

target 'App' do
pod 'BaseSDK'

target 'AppPro' do
pod 'ProSDK'

But somehow both targets in project are linked with latest version used in Podfile - 'ProSDK' and if switch lib versions for targets or set Base lib for Pro target - both targets will be linked with 'BaseSDK'.

Is there any lib with lite / pro versions in cocoapods? Or any thoughts about it, please?

Answer Source

Project has 2 targets and own .xcconfig files and there are #include CocoaPods .xcconfig files in it. But mistate was to #include both CocoaPods .xcconfig files for Base & Pro Podfile targets like so:

#include "Pods/Target Support Files/Pods-CommonPods-App/Pods-CommonPods-App.debug.xcconfig"
#include "Pods/Target Support Files/Pods-CommonPods-AppPro/Pods-CommonPods-AppPro.debug.xcconfig"

And 'Other LD flags' has been overwrote by latest.

So I've added new .xcconfig files in order to separate .xcconfig files for targets one of which includes Pods-CommonPods-App/Pods-CommonPods-App.debug.xcconfig and other Pods-CommonPods-App/Pods-CommonPods-AppPro.debug.xcconfig (same for release of course).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download