How can I set APPLICATION_EXTENSION_API_ONLY flag for only some targets using cocoapods?
<p>I'm developing an app with three (non-test) targets: <code>App</code>, <code>Extension</code> and <code>Shared</code>. The <code>Shared</code> target is included in both the <code>App</code> and <code>Extension</code> and provides, as you'd expect, shared functionality that both use.</p>

<p>I'm using cocoapods.</p>

<p>I need to set <code>APPLICATION_EXTENSION_API_ONLY=YES</code> in <code>Shared</code> and <code>Extension</code> in order to pass App Review and suppress warnings in Xcode.</p>

<p>I need to set <code>APPLICATION_EXTENSION_API_ONLY=NO</code> in <code>App</code> because I need to access e.g. <code>UIApplication.sharedApplication()</code> from inside the app.</p>

<p>Here's what I'm trying:</p>

<pre><code>source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

abstract_target 'Foo' do
    pod 'Parse'
    pod 'PubNub', '~&gt; 4.3'

        target :'Base' do
        end

        target :'App' do
            inherit! :search_paths
            pod 'JSQMessagesViewController', '~&gt; 7.2'
            pod 'NYTPhotoViewer', '~&gt; 1.1'
            pod 'Cloudinary', '~&gt; 1.0'
            pod 'CTAssetsPickerController', '~&gt; 3.3'
        end

        target :'Extension' do
        end
end

post_install do |installer|
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
        configuration.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
        configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
end

target :'App' do
   post_install do |installer|
       installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
           configuration.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
       end
   end
end
</code></pre>

<p></p>

<p>This fails because I am duplicating target names, I think. But how do I set this up to work properly?</p>