Question

I saw this answer and this is really what I need (Does a Core Data NSSet contain an object with a certain ID?), but the used ID in there is a user customized ID. Is it possible to check if a object with a specific NSManagedObjectID exists in a NSSet? How can I do that with KVC?

Was it helpful?

Solution

Given that

NSSet* mySetOfObjects;

contains your NSManagedObjects and you are looking for

NSManagedObjectID* specificObjectId;

the following should work:

[[mySetOfObjects valueForKeyPath:@"objectID"] containsObject:specificObjectId];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top