title: Class Foo is implemented in both MyApp and MyAppTestCase. One of the two will be used. Which one is undefined
body: <p>Recently I started Unit testing my application. This project (in Xcode4) was created without a unit test bundle so I had to set it up.
  I have followed the steps from here: <a href="http://cocoawithlove.com/2009/12/sample-mac-application-with-complete.html" rel="noreferrer">http://cocoawithlove.com/2009/12/sample-mac-application-with-complete.html</a>
  And It was working well for simple classes but now I am trying to test a class that depends on another and that on another, etc.</p>
  
  <p>First I got a linker error so I added <code>*.m</code> files to the test case target but now I get a warning for every class I am trying to test: </p>
  
  <blockquote>
    <p>Class Foo is implemented in both MyApp
    and MyAppTestCase. One of the two will
    be used. Which one is undefined.</p>
  </blockquote>
  
  <p>I wonder why is that? How can I solve this? Maybe I missed something when setting the unit test target?</p>
  
  <h3>Edit - The Solution</h3>
  
  <ul>
  <li><p>Set "Bundle Loader" correctly to <code>$(BUILT_PRODUCTS_DIR)/AppName.app/AppName</code></p></li>
  <li><p>Set "Symbols Hidden by Default" to <strong>NO</strong> (in Build Settings of the target application). This is where the linker errors come from because it is YES by default!. I've been struggling with this for so long!.</p></li>
  </ul>
  
  <p>Source: <a href="https://stackoverflow.com/questions/6461074/linking-error-for-unit-testing-with-xcode-4">Linking error for unit testing with XCode 4?</a></p>