here is the code i am working with.
NSString* path = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"plist"];
if(path == nil)
{
NSLog(@"file not found");
}
when i run this it prints file not found in the console.
my file.plist is in the supporting files folder in my cocoa project. where does mainBundle look for files at exactly. this is stumping me quite a bit. i get that it looks for the .app file, but when developing the app where doe mainBundle look?
pathForResource:ofType:
only looks in the Resources
folder (and localised folders). If you are placing files into dedicated folders in the bundle then you need to use pathForResource:ofType:inDirectory:
and supply the directory name.