3
votes

My project has iOS 4.3 as its deployment target.

All my pod libraries support 4.3 but one which I also want to include, taking care off course not to use its classes on iOS 4.3 devices.

I tried using the target option on my Podfile as follows:

platform :ios, '4.3'
pod 'NBUCore'

target :MyApp do
    platform :ios, '5.0'
    pod 'PEPhotoCropEditor'
end

Which creates the usual libPods.a with NBUCore and a new libPods-MyApp.a with PEPhotoCropEditor, both correctly linked to MyApp.

The problem is that there are two .xcconfig files, Pods.xcconfig and Pods-MyApp.xcconfig but only one of them gets activated by Cocoapods and thus link fails because each has an incomplete OTHER_LDFLAGS.

I have tried with both target :test, :exclusive => true and false.

Off course I could manually modify them, use both or add $(inherited) flags. But then Cocoapods should take care of that. Or maybe my Podfile syntax is wrong?

Edit: Turns out that also the "Copy Pods Resources" for both Pods and Pods-MyApp would also need to be merged.

2

2 Answers

1
votes

In my iOS 9.3+ project I have an iOS 11+ dependency. To make it work I:

  • Set my project and Podfile to iOS 11.
  • pod install
  • Set back my project to iOS 9.3.
  • In the generated Pods project set all the non-3rd party Pods-xxx targets to 9.3.
  • Use preprocessor macros to fix any compilation issues.

Original Answer

It is not possible with the current Cocoapods (filed an issue here).

The solution for now is to separate Pods by deployment target:

platform :ios, '4.3'
pod 'NBUCore'

target :MyApp do
    platform :ios, '5.0'
    pod 'PEPhotoCropEditor'
end

Then "merge" the .xcconfig files.

Finally add all resources' scripts to the "Copy Pods Resources":

"${SRCROOT}/Pods/Pods-resources.sh"
"${SRCROOT}/Pods/Pods-MyApp-resources.sh"
0
votes

I don't think it's possible to do what you want. You could, however, copy PEPhotoCropEditor's Podfile to your project and change s.ios.deployment_target = '5.0' to s.ios.deployment_target = '4.3'.

Then, in your Podfile, instead of

pod 'PEPhotoCropEditor'

do

pod 'PEPhotoCropEditor', :path => "CustomPodspec.podspec"