Instance Method

validateForInsert:

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

Declaration

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

Parameters

error

If the receiver cannot be inserted in its current state, upon return contains an instance of NSError that describes the problem.

Return Value

YES if the receiver can be inserted in its current state, otherwise NO.

Discussion

Subclasses should invoke super’s implementation before performing their own validation, and should combine any error returned by super’s implementation with their own (see Managed Object Validation).

Discussion

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.

- validateForUpdate:

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

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.