• 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
KVO/KVC compliance, signature for -validate<Key>: error:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO/KVC compliance, signature for -validate<Key>: error:


  • Subject: KVO/KVC compliance, signature for -validate<Key>: error:
  • From: Don Briggs <email@hidden>
  • Date: Thu, 1 Jan 2004 15:45:04 -0800

Hello, all 

In (new?) documentation for KVC compliance, I saw at

http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/Compliant.html#//apple_ref/doc/uid/20002172

"  Your class should implement -validate<Key>:error: if validation is appropriate for the key."

and I'm concerned about the exact signature expected.

In NSKeyValueCoding, I see
- (BOOL) validateValue: (id *) ioValue forKey: (NSString *) key error: (NSError **) outError
and
- (BOOL) validateValue: (id *) ioValue forKeyPath: (NSString *) inKeyPath error: (NSError **) outError

Therefore, for an attribute of type NSString with the key @"name", I INFER that I should provide
-(BOOL) validateName: (NSString*)testName error: (NSError **) outError;

and for an attribute of type NSNumber with the key @"uniqueID" I should provide
-(BOOL) validateUniqueID: (NSNumber*)testID error: (NSError **) outError;

Do I infer correctly?
Have I missed more complete documentation?

Next question:
What happens to the instance of NSError?
How is it used?
How would I best intervene with the Controller Layer to, say, display a sheet with information from the NSError that results when the user supplies an invalid value?
(Again, have I missed more complete documentation?)

Regards,
Don
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: KVO/KVC compliance, signature for -validate<Key>: error:
      • From: Scott Anguish <email@hidden>
    • Re: KVO/KVC compliance, signature for -validate<Key>: error:
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Localization question
  • Next by Date: Re: Encryption
  • Previous by thread: Re: Localization question
  • Next by thread: Re: KVO/KVC compliance, signature for -validate<Key>: error:
  • Index(es):
    • Date
    • Thread