Instance Method

validateForDelete:

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

Declaration

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

Parameters

error

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

Return Value

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

Discussion

An object cannot be deleted if it has a relationship has a “deny” delete rule and that relationship has a destination object.

NSManagedObject’s implementation sends the receiver’s entity description a message which performs basic checking based on the presence or absence of values.

See Also

Managing Data Validation

- validateValue:forKey:error:

Validates a property value for a given key.

- validateForInsert:

Determines whether the managed object can be inserted 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.

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