How to write a value validation method for core data?
Posted
by mystify
on Stack Overflow
See other posts from Stack Overflow
or by mystify
Published on 2010-06-07T20:18:55Z
Indexed on
2010/06/07
20:22 UTC
Read the original article
Hit count: 182
The docs say:
you should implement methods of the form validate:error:, as defined by the NSKeyValueCoding protocol
so lets say I have an attribute which is an int: friendAge
I want to make sure that any friend may not be younger than 30. So how would I make that validation method?
-validateFriendAge:error:
What am I gonna do in there, exactly? And what shall I do with that NSError I get passed? I think it has an dictionary where I can return a humanly readable string in an arbitrary language (i.e. the one that's used currently), so I can output a reasonable error like: "Friend is not old enough"... how to do that?
© Stack Overflow or respective owner