CoreData: Validation errors have "%{PROPERTY}@" in the localized description?
CoreData: Validation errors have "%{PROPERTY}@" in the localized description?
- Subject: CoreData: Validation errors have "%{PROPERTY}@" in the localized description?
- From: Jim Correia <email@hidden>
- Date: Wed, 11 Apr 2007 17:35:53 -0400
I have an application that I've built from the CoreData document
template.
If I have a basic validation error (i.e. nil value for an attribute
which is required) CoreData uses the attribute name in the localized
description of the generated error.
However, for my own validation errors, I'm seeing "%{PROPERTY}@ is
not valid".
How can I correct this?
I've tried generating errors with and without userInfo dicts. Here's
a sample implementation.
- (BOOL)validateName:(id *)valueRef error:(NSError **)error
{
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setObject: self forKey: NSValidationObjectErrorKey];
[userInfo setObject: @"name" forKey: NSValidationKeyErrorKey];
if (*valueRef != nil) {
[userInfo setObject: *valueRef forKey: NSValidationValueErrorKey];
}
*error = [NSError errorWithDomain: NSCocoaErrorDomain code:
NSManagedObjectValidationError userInfo: userInfo];
}
return NO;
}
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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