dontWatchMyProfile
dontWatchMyProfile

Reputation: 46360

When does validation happen in Core Data?

From the docs:

If you make changes to managed objects associated with a given context, those changes remain local to that context until you commit the changes by sending the context a save: message. At that point—provided that there are no validation errors—the changes are committed to the store.

So does that essentially mean, that validation happens automatically as soon as I call -save?

Upvotes: 1

Views: 204

Answers (1)

Barry Wark
Barry Wark

Reputation: 107754

Yes, validation is performed by the managed object context on save. You can manually validate an instance at any time by sending it a -validateFor[Insert|Update|Delete]:, depending on the action that will occur on context save.

Upvotes: 2

Related Questions