4

I have a main project and a static library project inside the main project. I want few plists in my static library project. Since there is no resource directory it is not possible to add plists directly, What is did is this.

1.Added a loadable bundle to my static library project 2.Added few plists to loadable bundle 3.This loadable bundle is made as a dependency to my static library project 4.Added this loadable bundle as a dependency to my main project as well

Am i going on the right path ? when i fired the build and used show contents to see the contents of the app i was able to see the .bundle file inside the .app file. Right now i want to know how to access this bundle . .

i used this

NSBundle *staticlink = [NSBundle mainBundle] pathForResource:@"MyBundle" ofType:@"bundle"];
[staticlink load];
NSLog(@"%@",staticlink);

console said this . .

 . . . /mainproject.app/MyBundle.bundle <not yet loaded>

What is missing ? what should i do load MyBundle ?

thndrkiss
  • 4,515
  • 8
  • 57
  • 96

1 Answers1

2

-pathFoResource:ofType: returns a NSString object which will have the path to the bundle.

NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"MyBundle" ofType:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
[bundle load];
Deepak Danduprolu
  • 44,595
  • 12
  • 101
  • 105