title: Xcode Static libraries building in wrong folder
body: <p>I've setup cocoapods for my project and I've been doing development for quite some time without any issues. Recently I added a new Configuration for it called "Beta", duplicating the "Release" configuration. At the same time, I added a Scheme that would build targets using this configuration.</p>
  
  <p>This new scheme would build everything without issues, but linking would fail with the (quite known it seems) message:</p>
  
  <blockquote>
    <p><code>ld: library not found for -lPods</code></p>
  </blockquote>
  
  <p>I know that issues that makes this error message come up have been discussed widely around the web, with different causes and conditions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/9863836/library-not-found-for-lpods">library not found for -lPods</a></li>
  <li><a href="https://github.com/CocoaPods/CocoaPods/issues/155" rel="nofollow noreferrer">https://github.com/CocoaPods/CocoaPods/issues/155</a></li>
  </ul>
  
  <p>None of these fixes seem to apply here. What I can see by looking into the workspace folder, is that Cocoapods build products are put in <code>Build/Products/Release-iphonesimulator</code> instead of in <code>Build/Products/Beta-iphonesimulator</code>, even though the app itself is built rightly so into the latter. Moving all the <code>*.a</code> files into <code>Build/Products/Beta-iphonesimulator</code> makes running in the simulator work properly, but the next build is still put in the wrong location.</p>
  
  <h3>Edit</h3>
  
  <p>After some further investigations, the environment variable <code>$BUILT_PRODUCTS_DIR</code> is set correctly in the build phase for the app itself, but not when building cocoapods products.</p>
  
  <p>What causes this and how can I fix this?</p>
  
  <h3>Ruled out issues</h3>
  
  <ul>
  <li><code>pod install</code> has been run, multiple times</li>
  <li>I'm working in the workspace, not in the project</li>
  <li>The cocoapods configuration file in the new configuration is properly set</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/7aToK.png" alt="enter image description here"></p>
  
  <ul>
  <li>Build locations in the preferences seem fine</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/9NCdw.png" alt="enter image description here"></p>