Since CocoaPods 0.38, pod targets are de-duplicated across multiple user targets. But this led to the issue that if the pod's source files rely on precompiler definitions to determine conditional API availability, then this can't be re-exposed through the de-duplication in individual variants for each integrating target.
This could occur e.g. when a pod offers a limited extension API (APPLICATION_EXTENSION_API_ONLY
),
but is used for the app and an extension.
The app should then be able to use full API.
This was given before CocoaPods 0.38, because the
pod target was generated multiple times and so also built multiple times.
The feature effectively restricts those pods to have only the limited API available for all targets
depending on that pod.
Please note that this only applies as long as the implementation files contain conditional source code. Differences in the header files are retained after the build and exposed to integrating targets.
A subspec for extensions definining the precompiler definitions for the pod_target_xcconfig
and user_target_xcconfig
is one way to avoid that issue, because the CocoaPods analyzer
will recognize that the pod is used with different sets of subspecs and will duplicate the
pod targets by itself.
If you need this hook in your Podfile:
- Please inform the owner of the podspec about your issues.
- Comment on this Gist, so that the CocoaPods team can figure out whether force duplicating individual pods is something needed in general and in long-term and should get enhanced support in the Podfile DSL.