J'utilise coreData pour mon application et j'utilise le projet de base d'apple "Master-Detail View application"
j'utilise le code suivant pour insérer mes objets. Ca marche très bien sur ma page MasterViewController.m, mais pas sur une page Add.m que j'ai créer.
NSManagedObjectContext *context = self.managedObjectContext;
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"Gift" inManagedObjectContext:context];
[newManagedObject setValue:@"Owner" forKey:@"giftOwner"];
// Save the context.
NSError *error = nil;
if (![context save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
J'ai ce message d'erreur :
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Gift''
Je ne comprend pas bien ce qui se passe. Quelqu'un peut-il m'aiguiller?
Merci d'avance
[iOS]CoreData
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.