Instance Method

validateForDelete()

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

Declaration

func validateForDelete() throws

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

true if the receiver can be deleted in its current state, otherwise false.

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

func validateForInsert()

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

func validateForUpdate()

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

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.