Is it possible to serve two xcdatamodeld master data in one project and load each according to the conditional?
I have BTPModel.xcdatamodeldandFTModel.xcdatamodeld
According to the comments, this line below does the following:
NSManagedObjectModel model = [NSManagedObjectModel mergedModelFromBundles:nil];
// view all models in the specified packages and merge them; if nil is specified as an argument, uses the main package
Can I do something like this? (pseudo code)
if (config == @"FT") {
model = [NSManagedObjectModel load:@"FTModel.xcdatamodeld"];
} else {
model = [NSManagedObjectModel load:@"BPTModel.xcdatamodeld"];
}
UPDATE:
I tried this
NSURL *url = [[NSBundle mainBundle] URLForResource:@"F11iModel" withExtension:@"xcdatamodeld"];
No luck. url remains null.
UPDATE
Extension - Mom. Now it works!
NSURL *url = [[NSBundle mainBundle] URLForResource:@"F11iModel" withExtension:@"momd"];
source
share