• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with validate<Key>:error: or NSError ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with validate<Key>:error: or NSError ?


  • Subject: Problem with validate<Key>:error: or NSError ?
  • From: Gonzalo Castro <email@hidden>
  • Date: Tue, 14 Aug 2007 21:02:50 -0400

Greetings,

Below is my property-level validation method. Why does the resulting alert only show the description (and an OK button) but not the value for NSLocalizedFailureReasonErrorKey? That is, why does the string "the failure reason goes here" not appear?

- (BOOL) validateEmployee:(id *)value error:(NSError **)error
{
if ( [*value valueForKey: @"name"] == nil )
{
if ( error != nil )
{
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"the description goes here", NSLocalizedDescriptionKey,
@"the failure reason goes here.", NSLocalizedFailureReasonErrorKey,
nil];


NSError *myError = [[[NSError alloc] initWithDomain: @"my.silly.domain"
code: 3
userInfo: userInfo] autorelease];


			*error = myError;
		}

		return NO;
	}
	else
	{
		return YES;
	}
}


Thanks, Gonzalo

_______________________________________________

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


  • Prev by Date: Re: Force a NSArrayController to fetch ?
  • Next by Date: Re: Open Recent Menu
  • Previous by thread: Re: Force a NSArrayController to fetch ?
  • Next by thread: Re: Cocoa-dev Digest, Vol 4, Issue 795
  • Index(es):
    • Date
    • Thread