Does correcting a value in an validation method mark the object as dirty?
Posted
by dontWatchMyProfile
on Stack Overflow
See other posts from Stack Overflow
or by dontWatchMyProfile
Published on 2010-06-13T07:06:58Z
Indexed on
2010/06/13
7:12 UTC
Read the original article
Hit count: 273
From the docs:
If you change the input value in a validate:error: method, you must ensure that you only change the value if it is invalid or uncoerced. The reason is that, since the object and context are now dirtied, Core Data may validate that key again later. If you keep performing a coercion in a validation method, this can therefore produce an infinite loop.
So when I modify a value in a validation method, the context gets dirtied? And the next time I save, the validation happens again - and when I change the value even if the validation is OK, then the context is again dirtied, and revalidated again - and I change the value, and Core Data validates, again, because the context is dirtied. And so on...for ever... is that right? Or did they try to say something different?
© Stack Overflow or respective owner