A for Alpha
A for Alpha

Reputation: 2912

how to access a file which is a not a part of main bundle in iOS

i have a file in the main bundle which i am accessing by using the following code base.

   NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"DataHouse" ofType:@"momd"];
   NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
   managedObjectModel_ = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];

But i have a special requirement where in the above mentioned Core data datamodel file will not be a part of the main bundle and will become a part of a custom made framework. Is there anyway in which i can access that file without referring it from the Bundle... In other words, how can i access the core data file without giving the path name.

Upvotes: 0

Views: 389

Answers (1)

Stefan Ticu
Stefan Ticu

Reputation: 2103

It will then become part of another custom bundle ; you'll get its path like this :

[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Custom.bundle/Images/exemple.png"]

Upvotes: 4

Related Questions