title: Strip a framework inside a static library if not needed
body: <p>I have an iOS static library which uses a couple of frameworks, e.g. FacebookSDK. Some of the apps that use my library need that SDK, and some don't. I'm trying to make Xcode strip Facebook SDK when building any project that does't need it. Here's what I've done:</p>
  
  <ul>
  <li>Set Dead Code Stripping to YES in both the library and the client app project</li>
  <li>Added the <code>-dead_strip</code> linker flag to both projects</li>
  <li>Made FacebookSDK an optional framework in the client app</li>
  <li>Made sure I don't create any Facebook objects in my app (by running grep on the code among other things).</li>
  </ul>
  
  <p>And yet FacebookSDK keeps get rolled into the app binary.  The command <code>nm MyApp.app/MyApp  | grep FB</code> returns a whole bunch of Facebook symbols.</p>
  
  <p>But why is Facebook getting linked? And how to avoid it?</p>