I have created a subproject as a static library and added a bundle to it, so I can wrap the project and resources that will be used by all programs using that library.
I have followed the instructions here. http://www.galloway.me.uk/tutorials/ios-library-with-resources/
It is working fine, except when I have to work with resources like images and other files.
I thought that by importing a library and its resources to another project I could access them easily but this is not the case.
Every time I have to access a resource file on library's bundle I have to use this:
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"MyLibraryBundle" withExtension:@"bundle"]];
path = [bundle pathForResource:@"readme" ofType:"txt"];
but if the resource is on the main program I have to use [NSBundle mainBundle] instead.
This is creating a very complex logic because I may have more than one subproject and I will have to create zillions of variations.
Is there a way to make a way the app can find the resource whatever it is using a simple syntax or am I missing something?