What in the world am I doing wrong here? Frustrated beyond belief.
I have an array that contains a certain type of object with a property. We’ll just call that property “number”. It is of type NSUInteger.
I also have an entity that has an attribute of “number”, with a type of Integer 64.
I’m trying to create a fetch request that finds me all the objects in my Core Data store that do not exist in the other array with objects.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
fetchRequest.entity = [NSEntityDescription entityForName:@"EntityName" inManagedObjectContext:context];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"NOT (%@.number IN number)",someArrayWithObjects];
NSError *error = nil;
NSArray *notMatchingObjects = [context executeFetchRequest:fetchRequest error:&error];
This returns a nil array. I know that I have objects with numbers in my local store that do not exist in my other array. Am I doing something wrong?
Use the fact that NSArrays are key-value coding compliant and will give you an array of property values with
valueForKey:(For NSUInteger it will wrap them in NSNumbers)