Problems linking iOS app with custom framework
<p>I'm splitting a largish iOS app into a few frameworks, and I'm facing the following problem:</p>

<p><strong>How do I properly include a custom Cocoa Touch framework project into an iOS app project, so that everything links properly?</strong></p>

<ol>
<li>I have created a project framework, with all the necessary code inside.</li>
<li>To test things out, I've created a sample workspace, and added the framework project to it.</li>
<li>Next, I've created a sample iOS app project, with a few lines of code using the framework, and added the project to the workspace as well.</li>
</ol>

<p>Now, I get to the linking part.</p>

<p><strong>First attempt:</strong></p>

<ol>
<li><p>Open the app target settings in Xcode, select the <code>Info</code> pane, and add the framework in the <code>Linked Frameworks and Libraries</code> section.</p></li>
<li><p>To make things nice, I also select the newly added framework in the app project, and change it's <code>Location</code> from <code>Relative to Group</code> to <code>Relative to Build Products</code>. Beneath the location shows as <code>../Debug-iphonesimulator/MyFramework.framework</code></p></li>
<li><p>The current scheme is <code>&lt;Simulator, Debug&gt;</code>, I hit <code>Run</code>, and <strong>everything works as it should - the app logs that it's using the framework fine</strong>.</p></li>
<li><p>Now, I clean the build folder, and change the scheme to <code>&lt;Simulator, Release&gt;</code>.</p></li>
<li><p>Next, I hit <code>Run</code>, the projects start building, and then <strong>app linking fails</strong>:</p></li>
</ol>

<p><code>Undefined symbols for architecture x86_64: &lt;a function from the framework&gt; referenced from: &lt;a file in the app&gt;</code>.</p>

<p>Upon inspecting the build folder, I can see that the framework was built properly, resides in <code>.../Build/Products/Release-iphonesimulator/...</code>, and is a fat binary with both i386 and x86_64 inside.</p>

<p><strong>How should I proceed to properly link the framework, so that it works in any configuration (Debug, Release), and on both the simulator and, of course, devices?</strong></p>

<p>To clarify, I intend to develop both the framework(s), and the app simultaneously, so a solution like e.g. CocoaPods does it, by pre-building fat frameworks once, seems not very practical (unless I'm missing something, due to lack of sufficient experience with CocoaPods).</p>

<hr>

<p>Below is the failing <code>Link</code> phase output:</p>

<pre><code>Ld /Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Intermediates/MyApp.build/Release-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp normal x86_64
    cd /some/where/here/lives/the/workspace
    export IPHONEOS_DEPLOYMENT_TARGET=9.3
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
      -arch x86_64
      -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk
      -L/Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Products/Release-iphonesimulator
      -F/Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Products/Release-iphonesimulator
      -filelist /Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Intermediates/MyApp.build/Release-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp.LinkFileList
      -Xlinker
      -rpath
      -Xlinker @executable_path/Frameworks
      -mios-simulator-version-min=9.3
      -Xlinker
      -objc_abi_version
      -Xlinker 2
      -fobjc-arc
      -fobjc-link-runtime
      -stdlib=libc++
      -framework MyFramework 
      -Xlinker
      -dependency_info
      -Xlinker /Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Intermediates/MyApp.build/Release-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_dependency_info.dat
      -o /Users/me/Library/Developer/Xcode/DerivedData/MyWorkspace-ahzqvfgoxbedpudjdhtqudgqzwba/Build/Intermediates/MyApp.build/Release-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp

Undefined symbols for architecture x86_64:
  "SomeFancyFuncFromTheFramework()", referenced from:
      -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
</code></pre>