views:

109

answers:

2

I am trying to find the full path for a file called 'file1.jpg'

I have verified that it is in the app bundle and yet when I run this code:

NSBundle* myBundle = [NSBundle mainBundle];  

NSString* path = [myBundle pathForResource:@"file1" ofType:@"jpg"];

'path' doesn't have the path/file i'm expecting.

This is code directly from the Apple documentation...

Any ideas what I'm doing wrong?

G-Man

+3  A: 

If path is nil then file1.jpg does not exist in your application bundle. Make sure that it is in your project and that it is set to be included in your current target. Also, it is case sensitive, so make sure that the file is really named file1.jpg and not file1.JPG or file1.jpeg or something.

Jason Coco
A: 

It also helps if you are building the DEBUG version and not the RELEASE version when using the debugger :)

GeoffreyF67