James Skidmore
James Skidmore

Reputation: 50288

Xcode not finding directory within resources group

Xcode will not seem to recognize a particular directory of files in the Resources group. This is how I'm retrieving the folder:

NSString *tileDirectory = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Tiles"];

And this is the error that I get:

2011-03-06 17:52:47.660 [*removed*][36648:207] Could not locate any tiles at /Users/james/Library/Application Support/iPhone Simulator/4.2/Applications/909785DD-B3E8-41CB-A3D9-C19D1826C448/[*removed*].app/Tiles

I checked, and sure enough that directory does not exist. But it does exist in the project directory.

I have done the following:

Upvotes: 1

Views: 1016

Answers (1)

occulus
occulus

Reputation: 17014

File groups in XCode don't necessarily translate to folders inside your compiled application bundle.

Try using this alternate method for accessing your application resources:

[[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"txt"]; 

Note that you don't have to specify where your MyFile.txt file actually is -- as long as it exists in your project as a resource, it will be found.

Upvotes: 3

Related Questions