I am attempting to get a count of items in an array to place it in the right detail of a cell. Interestingly enough I am getting the proper count but my when I try to NSLog the array it returns <fault>.
NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"muscleGroup == %@ && specificExercise == %@ && date >= %@ && date < %@", theMuscleGroup, theExercise, fromDate, toDate];
NSFetchRequest *fetchRequestTemp = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"WeightLiftingInfo" inManagedObjectContext:_managedObjectContext];
[fetchRequestTemp setPredicate:searchPredicate];
[fetchRequestTemp setEntity:entity];
NSError *error;
NSArray *tempArray = [[NSArray alloc] initWithArray:[_managedObjectContext executeFetchRequest:fetchRequestTemp error:&error]];
NSLog(@"%@", tempArray);
NSLog(@"%d", [tempArray count]);
My Question:
Basically, what am I doing wrong? Am i initing the array improperly or trying to log it improperly?
I have been researching for hours and trying different coding, but cannot figure it out. Any help would be appreciated. If you need more info or I am doing something against guidelines according to SO please let me know before you close this thread or “-1”. HAVE MERCY, I am new and leaning:)
When you execute your fetch request, you get back a managed object fault. That is, a proxy-like object that represents the results even though the real data objects haven’t been loaded from the data store yet. The fault knows how many objects are in the array, etc., and when you access the objects the fault will transparently load the real objects.
So, situation normal, don’t worry about it. Try using the results instead of logging them and I think you’ll find that things work fine.