title: How can I remove pod links from a specific target in a post_install hook?
body: <p><strong>Background</strong></p>
  
  <ol>
  <li>Had an existing iOS app using CocoaPods for all dependency management</li>
  <li>Added an embedded Cocoa Touch framework (to share code with extensions)</li>
  </ol>
  
  <p><strong>Issue</strong></p>
  
  <p>Some libraries linked through CocoaPods having <em>"duplicated implementation"</em> across both the framework and app. This causes the app to crash when arbitrarily choosing an implementation to use in run-time. </p>
  
  <p>This is apparently a bug within CocoaPods, as most of my dependencies link and run fine - only had issues with a few (Firebase, Fabric, AppsFlyerFramework).</p>
  
  <hr>
  
  <p>I was <a href="https://github.com/CocoaPods/CocoaPods/issues/6918#issuecomment-319447830" rel="nofollow noreferrer">proposed</a>  a solution to try creating a post install hook to remove the double linking, but I am not sure how best to do approach this.</p>
  
  <p>How can I easily remove dependency links from a specific target through the post install hook? I have seen some <code>post_install</code> hooks like this, but this removes a specific file whereas I need to remove the whole pod link.</p>
  
  <pre><code>post_install do |installer|
      installer.pods_project.targets.each do |target|
          if target.name == 'Pods-Earthlings'
              source_files = target.source_build_phase.files
              dummy = source_files.find do |file|
                  file.file_ref.name == 'SomeDuplicate.m'
              end
              source_files.delete dummy
          end
      end
  end
  </code></pre>