---
title: validateForUpdate()
framework: coredata
role: symbol
role_heading: Instance Method
path: coredata/nsmanagedobject/validateforupdate()
---

# validateForUpdate()

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

## Declaration

```swift
func validateForUpdate() throws
```

## Discussion

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. important: 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).

## See Also

### Managing Data Validation

- [validateValue(_:forKey:)](coredata/nsmanagedobject/validatevalue(_:forkey:).md)
- [validateForDelete()](coredata/nsmanagedobject/validatefordelete().md)
- [validateForInsert()](coredata/nsmanagedobject/validateforinsert().md)
- [Validation error codes](coredata/1535452-validation-error-codes.md)
- [NSValidationKeyErrorKey](coredata/nsvalidationkeyerrorkey.md)
- [NSValidationObjectErrorKey](coredata/nsvalidationobjecterrorkey.md)
- [NSValidationPredicateErrorKey](coredata/nsvalidationpredicateerrorkey.md)
- [NSValidationValueErrorKey](coredata/nsvalidationvalueerrorkey.md)
