Sami
Sami

Reputation: 1404

Objective-C pathForResource doesn't find file, returns null

The code i'm using below doesn't seem to find the file i want, can anyone help?

NSString *path = [[NSBundle mainBundle] pathForResource:@"iTunes Music Library" ofType:@".xml" inDirectory:@"~/Music/iTunes/"];
NSLog(@"%@", path);

Thanks, Sami.

Upvotes: 1

Views: 1124

Answers (1)

Rob Napier
Rob Napier

Reputation: 299275

This is looking inside your bundle, so it would be something like /Applications/My App.app/Contents/Resources/~/Music/iTunes (if "~" there is even legal). You're not looking for a bundle resource here. Why are you making this call to find the path of a file you already know the path to?

Upvotes: 4

Related Questions