Note that there are some explanatory texts on larger screens.

plurals
  1. POResource files in subdirectory are copied to root directory of the app bundle
    text
    copied!<p>I am not sure whether this is expected or it is bug. I am trying to create the same folder structure in disk as that in XCode. I use the following steps to add resource files to my project:</p> <ol> <li>Create a <code>Resources</code> folder under the root folder of the project.</li> <li>Drag the <code>Resources</code> folder to XCode, which creates a <code>Group</code> for the folder.</li> <li>Drag my resource files from <code>Finder</code> to the <code>Resources</code> folder in XCode.</li> </ol> <p>And now I can see all the resource files are listed in <code>Build Phrases</code>-><code>Copy Bundle Resources</code>.</p> <p>The weird thing is that <code>[[NSBundle mainBundle] pathForResource:@"book" ofType:@"epub"]</code> returns a file path that can be located, while <code>[[NSBundle mainBundle] pathForResource:@"book" ofType:@"epub" inDirectory:@"Resources"]</code> returns <code>(null)</code>.</p> <p>From the <code>Build Results</code> window, I notice this line:</p> <pre><code>CpResource MBookReader/Resources/book.epub /Users/neevek/Library/Developer/Xcode/DerivedData/workspace-fykuaikryknuhxgevcdtspkspptj/Build/Products/Debug-iphonesimulator/MBookReader.app/book.epub cd /Users/neevek/workspace/xcode_projects/MBookReader setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip /Users/neevek/workspace/xcode_projects/MBookReader/MBookReader/Resources/book.epub /Users/neevek/Library/Developer/Xcode/DerivedData/workspace-fykuaikryknuhxgevcdtspkspptj/Build/Products/Debug-iphonesimulator/MBookReader.app </code></pre> <p>which shows that <code>Resources/book.epub</code> file is indeed copied to <code>MBookReader.app/</code>(the root directory of the app bundle). </p> <p>Now <code>Resources</code> is a real folder in disk, why the folder itself is not copied?</p> <p>PS. I am using XCode 4.3.2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload