Cocoapods: workaround for using subspecs with different configurations

Created on 26 Nov 2018  路  4Comments  路  Source: CocoaPods/CocoaPods

The issue of installing individual subspecs across different build configurations has been raised in the past: https://github.com/CocoaPods/CocoaPods/issues/3503

Is there a workaround for this issue? Here's a typical scenario:

pod 'MySDK/Core'
pod 'MySDK/Foo_Debug', :configuration => 'Debug'
pod 'MySDK/Foo_Release', :configuration => 'Release'

Most helpful comment

The best workaround is to define those in root podspecs and not use subspecs.

All 4 comments

The best workaround is to define those in root podspecs and not use subspecs.

That's a good idea.

Of course git tags then become an issue... I guess I'll have to work out a prefix for tags like pod-mysdk-core-1.2.3 and pod-mysdk-foo-debug-4.1.2

Actually, the main problem with this workaround is if both subspecs are subdependencies of the main podspec. If you define the subdependencies in root podspecs, you end up with the following:

Pod::Spec.new do |spec|
    spec.name                   = "MySDK"
    spec.dependency 'Subdependency_Debug'
    spec.dependency 'Subdependency_Release'

This builds successfully, but when running the Debug build configuration I get a runtime error:
dyld: Library not loaded: @rpath/Subdependency_Release.framework/Subdependency_Release

This seems to be a result of my MySDK linking against Subdependency_Debug and Subdependency_Release, and then it unable to find one of them at runtime.

This could be solved with the creation of separate targets. Are there better options?

nope.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marzapower picture marzapower  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments

gerchicov-bp picture gerchicov-bp  路  3Comments

steffendsommer picture steffendsommer  路  3Comments

intelliot picture intelliot  路  3Comments