How to use CocoaPods with multiple Framework subprojects
<p>First of all, I've turned on use_framework! in Podfile.</p>
<p>Assume the main project is MAIN_APP, and two subprojects are FRAMEWORK_A and FRAMEWORK_B.</p>
<p>MAIN_APP requires FRAMEWORK_A and FRAMEWORK_B, and FRAMEWORK_B requires FRAMEWORK_A as well.</p>
<p>All projects/targets are using CocoaPods to manage third party libraries.</p>
<p>For now, my Podfile looks like:</p>
<pre><code>target :MAIN_APP do
    project 'MAIN_APP'
    pod 'PodA'
end

target :FRAMEWORK_A do
    project 'FRAMEWORK_A'
    pod 'PodB'
end

target :FRAMEWORK_B do
    project 'FRAMEWORK_B'
    pod 'PodC'
end
</code></pre>
<p>I manually added FRAMEWORK_A to build settings of FRAMEWORK_B, and both FRAMEWORK_A and FRAMEWORK_B to build settings of MAIN_APP.</p>
<p>All code compiles well, but when running the MAIN_APP crashes because it cannot load Framework of PodB.</p>
<p>I know I can manually add PodB to MAIN_APP and FRAMEWORK_B as well, but is it possible to define this kind of target dependency in Podfile?</p>
<p>Btw, when <code>pod install</code>, I got the warning:</p>
<blockquote>
<p>[!] The Podfile contains framework targets, for which the Podfile does not contain host targets (targets which embed the framework).</p>
<p>If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target).</p>
</blockquote>
<p>As I know, I can use nested target for host targets like:</p>
<pre><code>target :FRAMEWORK_A
    target :MAIN_APP
    end
end
</code></pre>
<p>So CocoaPods will setup MAIN_APP to use FRAMEWORK_A and inherit pod dependencies from FRAMEWORK_A. But seems I cannot do it with multiple dependencies like:</p>
<pre><code>target :FRAMEWORK_A
    target :MAIN_APP
    end
end
target :FRAMEWORK_B
    target :MAIN_APP
    end
end
</code></pre>
<p>Because target :MAIN_APP cannot be declared twice.</p>
<p>Is there any better solutions instead of defining pod dependencies as a function in Podfile and include in all target?</p>