3131 Views 5 Replies Latest reply: Sep 12, 2008 10:25 AM by jerbeers
I never tried with a "folder" resource but all other files work well. I used the two normal methods:
1) put the files in the project directory then "add existing file" in the resource folder
2) do not move the files to the project, select "add existing files" and switch on the "copy files to destination folders (if needed)" checkbox in the window that's popping up.
Both cases are ok in my Xcode; if you do the second action without checking the flag on, the files are not moved when building to a device or simulator.
You can also check the resource list in the your-project.xcodeproj package (file project.pbxproj in it).
No other ideas.
I'm just guessing, but I think you might be getting confused because it includes resources in the application bundle. If you look at the app file in the simulator directory, you can see these files by right-clicking and choosing "Show package contents". You can access these files in code by using
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"resource.gif"];
awesome. It all became clear after looking in the package contents. So I wanted to add my resource directory with folder references (it turned blue) and then accessed as you showed above but by referencing my resource directory with
NSString *rPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"data"];
.. where data was the directory of resources that I added.
thanks very much. That helped a lot