title: Why can't code inside unit tests find bundle resources?
body: <p>Some code I am unit testing needs to load a resource file. It contains the following line:</p>
  
  <pre><code>NSString *path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"txt"];
  </code></pre>
  
  <p>In the app it runs just fine, but when run by the unit testing framework <code>pathForResource:</code> returns nil, meaning it could not locate <code>foo.txt</code>.</p>
  
  <p>I've made sure that <code>foo.txt</code> is included in the <strong>Copy Bundle Resources</strong> build phase of the unit test target, so why can't it find the file?</p>