Re: How to Validate CoreData attribute value for uniqueness
Re: How to Validate CoreData attribute value for uniqueness
- Subject: Re: How to Validate CoreData attribute value for uniqueness
- From: Willeke <email@hidden>
- Date: Mon, 01 Sep 2014 13:34:48 +0200
Some ideas, I don't know if it works:
in your validation method, change
NSArray *allSpecies = [self.managedObjectContext executeFetchRequest:allSpeciesIDsFetchRequest error:nil];
NSArray *allCatalogIDs = [allSpecies valueForKeyPath:@"catalogID"];
if ([allCatalogIDs containsObject:*ioValue]) {
to something like
[allSpeciesIDsFetchRequest setPredicate:[NSPredicate predicateWithFormat:@"catalogID == %@", *ioValue]];
NSArray *species = [self.managedObjectContext executeFetchRequest:allSpeciesIDsFetchRequest error:nil];
if ([species count] > 1 ||
[species count] == 1 && [species objectAtIndex:0] != self) {
NSTextField can have a delegate which can implement
- (BOOL)control:(NSControl *)control isValidObject:(id)object
Willeke
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden