I'm trying to create a plain resource NSBundle that I can load in my iOS app that has some image assets, maybe some tweaked storyboard/nib files, and other data. It doesn't have anything executable in it, (therefore it can't be "loaded"), but I want to extract resources from it.
However, when I use actool to create an Assets.car into the bundle, I cannot extract images from it, even using the new UIImage method imageNamed:inBundle:compatibleWithTraitCollection:
// This should work, but just returns nil.
[UIImage imageNamed:@"bar" inBundle:bundle compatibleWithTraitCollection:nil];
My bundle file content structure is basically:
Foo.bundle/
- Assets.car
- Info.plist
- Resources/
- green.storyboardc
However, if I use raw images instead of compiling them into a .car (e.g. copy directly, or set actool's "--minimum-deployment-target" to "6.0"), then the file structure looks like:
Foo.bundle/
- bar.png
- bar@2x.png
- bar@3x.png
- Info.plist
- Resources/
- green.storyboardc
And it works, but I lose all slicing info, and other control with device-specific traits and templates, etc. Is there something I'm missing? This post by Rincewind from the old dev forums was written before the imageNamed:inBundle:compatibleWithTraitCollection: was released, but is the closest thing to say this is not possible.