Domanda

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?

È stato utile?

Soluzione

Given that

NSSet* mySetOfObjects;

contains your NSManagedObjects and you are looking for

NSManagedObjectID* specificObjectId;

the following should work:

[[mySetOfObjects valueForKeyPath:@"objectID"] containsObject:specificObjectId];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top