I am including a directory full of files in my app. I looked through the NSBundle docs, but I can't seem find out how to get the URL to this directory. I'm trying to use the main bundle object.
I have a directory "defaultImages" under a directory "Resources" in xCode. I have confirmed that these are being copied to the device, how do I get the URL to them?
Specifically, the following does not work.
[[NSBundle mainBundle]:URLForResource:@"defaultImages" withExtension:@"" subdirectory:@"Resources"];
尝试
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"defaultImages" ofType:@"footype"];
Apparently NSBundle will not locate a directory for you. My solution was to put the contents of the directory inside a bundle, via How to make an iOS asset bundle? . I then added that bundle to my main application bundle.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.