I have the following situation, I am trying to make a framework that consist of sub projects, each sub project is a static library and a bundle.
I am including those static libraries into the main project which is the framework, and also I need to include bundles to the main project
The following image can describe my structure https://drive.google.com/file/d/0B3tzx8whq3EvaS1JVmV0Mnl5Y3M/view?usp=sharing
note: I am adding bundles from sub projects into main output folder by copying them using build phase script
So my output is packaged as a framework that contain headers and bundles My questions are: How to access a specific bundle during run time? without make the customer to copy each bundle?
can I merge all bundles into one bundle? I mean a bundle that contain many bundles? and if yes how to use files in sub bundles?
Thanks a lot
I searched a lot and found the solution, first you can include bundles inside your bundle, so the user don't have to copy all bundles, just the main one.
We can reach any bundle inside a bundle like this:
NSBundle *mainBundle = [NSBundle bundleForClass:[self class]];
NSBundle *bundle = [NSBundle bundleWithURL:[mainBundle URLForResource:@"myMainBundle" withExtension:@"bundle"]];
So when you want to access any bundle inside bundle named myMainBundle.bundle you can get its path like this:
NSString *subBundlePath =[bundle pathForResource:@"subBundle" ofType:@"bundle"];
To copy bundle inside budle you can do from build phase script and set the path to copy is your main bundle.