0
votes

I have an application that utilizes Core Data for data persistence. My application is comprised of (4) Navigation Controllers inside a TabBarController. The Navigation Controller's root view controller is a UITableView Controller and when you select a cell it displays a Detail view controller in each case. I wanted the main application to be static so the user cannot edit the data and my update would be made using a separate application that I would use to update the data and then put out a new version.

I have completed the data applications and it successfully saves the data and I can call it back up to display and all appears well. I have also looked at the data with a SQlite Data browser to make certain it is all good.

I then take the populated .sqlit file and place it in the documents directory of the main application and make sure the names match see below:

NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"RoundTopApp.sqlite"];

After doing this and then running the application, I get the following error:

'+entityForName: could not locate an NSManagedObjectModel for entity name 'Place''

I have added the code below to note that I am using the NSFetchedResultsController to perform the fetch.

  • (void)viewDidLoad { [super viewDidLoad];

    NSError *error; if (![[self fetchedResultsController] performFetch:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); exit(-1); // Fail }

    self.title = @"Lodging"; }

I am not sure what is wrong here other than I have failed to add it to the application bundle or something.

Any help would be appreciated.

Hudson

1

1 Answers

0
votes

The error says that you are trying to access entities called "Place" from your data store, but that the Managed Object Model that you've defined in the app doesn't contain this entity. Perhaps you've added this entity in your other app where you're creating the data store? If so, you need to update the Managed Object Model in the app that is reading the data store to match the model in the app that has created the store.

Alternatively, if you've copied the Managed Object Model between the two apps, and you've only just copied this across, you probably need to do a Clean Build (Product > Clean). Ensure also that your new model is set as the current model, if you're maintaining a versioned model.