Update:
As Rhythmic Fistman mentioned the original answer's method gets overwritten when doing a new pod install.
Aelam provided the following method in this Github issue:
Add this to your podfile. remember to replace the target name
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == "Pods-YOU_EXTENSION_TARGET-AFNetworking"
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
end
end
end
end
Obsolete answer:
1) Be sure that pod 'AFNetworking'
is included for both targets (your container app and extension) in your podfile.
Example in my case:
target 'ContainerAppTarget', :exclusive => true do
pod "SDKThatInternallyUsesAFNetworking"
end
target 'ExtensionTarget', :exclusive => true do
pod 'AFNetworking'
end
2) In XCode, click on Pods on the hierarchy view to bring its build options. Then on the build options, select the target for which you are looking at the build options in the dropdown. There select Pods-{Extension Target Name}-AFNetworking
(it should have been created automatically by pod install. Then select Build Settings. Then under Apple LLVM 6.0 - Language, verify that Prefix header has a filename. That filename on my case was Target Support Files/Pods-{Extension Target Name}-AFNetworking/Pods-{Extension Target Name}-AFNetworking-prefix.pch
. If it doesn't have such a filename or similar then add it.
3) Go to that prefix header file that was named there or you added there. It'll be almost empty, then add the following line at the end:
#define AF_APP_EXTENSIONS
That should allow your container app to point to a version of AFNetworking built normally and your extension app to another built with the flag set. So only one version of the library but built in two different ways, each on one of the targets.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…