my program needs to take a prepopulated sql database and then save the records to the app's database. Unfortunately for some reason the application quits in this method in the application delegate:
#pragma mark -
#pragma mark Core Data stack
- (NSManagedObjectModel *)managedObjectModel {
if (managedObjectModel_ != nil) {
return managedObjectModel_;
}
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"iProspectLite" ofType:@"sqlite"];
NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
managedObjectModel_ = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return managedObjectModel_;
}
it seems as if the application cannot find a valid managedObjectModel_, or it doesn't exist, or is not creating one. How do i solve this?
one of the error messages I get on the console is this: Terminating app due to uncaught exception reason: [NSKeyedUnarchiver initForReadingWithData:]
part of this I have narrowed down to the NSManagedObject, in that there doesn't seem to be one created or found.
Other information that may be helpful: I added an entity and defined attributes as described in many other core-data tutorials the following is the class that defines my entity:
#import "Mine.h"
@implementation Mine
@dynamic primarykey;
@dynamic name;
@dynamic firstCommodity;
@dynamic longitude;
@dynamic county;
@dynamic secondCommodity;
@dynamic latitude;
@dynamic thirdCommodity;
@end