Instance Method

validateForUpdate:

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

Declaration

- (BOOL)validateForUpdate:(NSError * _Nullable *)error;

Parameters

error

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

Return Value

YES if the receiver's current state is valid, otherwise NO.

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

- validateValue:forKey:error:

Validates a property value for a given key.

- validateForDelete:

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

- 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.

NSValidationKeyErrorKey

The error key for the attribute that failed to validate.

NSValidationObjectErrorKey

The error key for the object that failed to validate.

NSValidationPredicateErrorKey

The error key for the predicate that failed to validate.

NSValidationValueErrorKey

The error key for the value that failed to validate.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software