开发者

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

开发者 https://www.devze.com 2023-02-09 16:07 出处:网络
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\

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消