Sometimes, when I try to use an NSPredicate with an NSFetchRequest, the evaluatedObject it passes to the block is either nil or an instance of NSDictionaryMapNode, which nobody ever seems to have heard of.
Obviously this is problematic because the NSDictionaryMapNode is not part of a public API and has no useful methods that I need to use for my predicate.
Here's a really simple example:
fetchRequest.predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
NSLog(@"%@", NSStringFromClass([evaluatedObject class]);
return YES;
}];
Here I am expecting evaluatedObject to be an instance of a subclass of NSManagedObject, but instead it is an instance of NSDictionaryMapNode.
I've investigated this further, and it seems that this happens every time I perform a fetch after the first, which works fine. I don't know if it's maybe something to do with deallocation or if I use something twice that I shouldn't.
Probably this is the result of uniquing done by core data. See my comment.
Try to access the properties via key-value coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With