Core data countByEnumeratingWithState: objects: count: error

I have this error when I add kernel data to new relationships. I read a lot of resources in boarding schools, but they cannot help me ... Maybe you can ... This is my code, after which I add the relations:

std = [NSEntityDescription insertNewObjectForEntityForName:@"Student" inManagedObjectContext:self.context]; std.fio = fio.text; std.phone = phone.text; NSError *error; self.selectedGroups = MSGTVC.selectedGroups; for(Group *info in self.selectedGroups){ [std addGroupsObject:info]; } if (![self.context save:&error]) { NSLog(@"Cant Save: %@", [error localizedDescription]); } 

in the line [std addGroupsObject: info]; this is mistake:

Application termination due to the uncaught exception "NSInvalidArgumentException", reason: '- [Group countByEnumeratingWithState: objects: count:]: unrecognized selector sent to instance 0x816a1c0'

This is my code, then I assign value to the selected groups:

  NSArray *indexselected = [[NSArray alloc] initWithArray:[self.tableView indexPathsForSelectedRows __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0)]]; for (NSIndexPath *into in indexselected) { self.selectedGroups = [self.group objectAtIndex:into.row]; } 

I will be glad if you help solve this problem, thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1403593/


All Articles