I am having a brain meltdown trying to filter a fetchRequest.
I'm able to get the full details of every record of the entity, but I only want the details on the record at the current indexPath.
This is where my code is at present:
-(void) fetchStuff {
NSLog(@"%s", __FUNCTION__);
NSError *error = nil;
NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *woodgie = [NSEntityDescription entityForName:@"WidgetEntity" inManagedObjectContext:context];
[fetchRequest setEntity:woodgie];
NSArray *fetchResults = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
fetchedObjects = [fetchResults objectAtIndex:selectedRow];
NSLog(@"selectedRow: %i", selectedRow); //0
NSLog(@"fetchedObjects: %@", fetchedObjects);
for (WidgetEntity *wigglies in fetchedObjects ) {
NSSet *peopleSet = [wigglies valueForKey:@"people"];
for (id person in peopleSet) {
personName = [person valueForKey:@"name"];
NSLog(@"name = %@", personName);
}
NSSet *keywordSet = [wigglies valueForKey:@"keyword"];
for (id keyWord in keywordSet) {
keywordName = [keyWord valueForKey:@"word"];
NSLog(@"Keyword = %@", keywordName);
.....
}
I get an exception at this line " for (WidgetEntity *wigglies in fetchedObjects ) {" (countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance)..
but the truth is - I'm guessing how to filter the data.
Any help / pointers will be appreciated.