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] pathForResourc开发者_StackOverflowe:@"iTunes Music Library" ofType:@".xml" inDirectory:@"~/Music/iTunes/"];
NSLog(@"%@", path);
Thanks, Sami.
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?
精彩评论