Instance Method

validateForUpdate()

Determines whether the managed object's current state is valid.

Declaration

func validateForUpdate() throws

Parameters

error

If the receiver's current state is invalid, upon return contains an instance of NSError that describes the problem.

Return Value

true if the receiver's current state is valid, otherwise false.

Discussion

NSManagedObject’s implementation iterates through all of the receiver’s properties validating each in turn. If this results in more than one error, the userInfo dictionary in the NSError returned in error contains a key NSDetailedErrorsKey; the corresponding value is an array containing the individual validation errors. If you pass NULL as the error, validation will abort after the first failure.

See Also

Managing Data Validation

func validateForDelete()

Determines whether the managed object can be deleted in its current state.

func validateForInsert()

Determines whether the managed object can be inserted in its current state.

Validation Error Codes

Error codes related to validation of managed object properties.

let NSValidationKeyErrorKey: String

The error key for the attribute that failed to validate.

let NSValidationObjectErrorKey: String

The error key for the object that failed to validate.

let NSValidationPredicateErrorKey: String

The error key for the predicate that failed to validate.

let NSValidationValueErrorKey: String

The error key for the value that failed to validate.