thndrkiss
thndrkiss

Reputation: 4595

loadable bundle for plists

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 ?

Upvotes: 4

Views: 844

Answers (1)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

-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];

Upvotes: 2

Related Questions