Я пытаюсь получить объект из основных данных в зависимости от атрибута, называемого «имя».Вот мой код:
NSManagedObjectContext *context = [self managedObjectContext];
NSEntityDescription *vegetable = [NSEntityDescription insertNewObjectForEntityForName:@"Vegetable" inManagedObjectContext:context];
// get the vegetable using name
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSPredicate *predicate =
[NSPredicate predicateWithFormat:@"name == %@", myGardenViewModel.vegetable.name];
[request setEntity:vegetable];
[request setPredicate:predicate];
NSError *error;
NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:request error:&error];
В последней строке выдается следующее исключение:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Vegetable subentitiesByName]: unrecognized selector sent to instance 0x6bbcdd0'
есть идеи?