An encapsulation of conflicts that occur during an attempt to save a managed object.


class NSConstraintConflict : NSObject


A constraint conflict occurs when your data model is using unique constraints and one or more managed objects are violating that constraint.

When this error occurs, the error instance can be interrogated to determine which instance of NSManagedObject is violating the constraint and which property on the NSManagedObject instance is in violation.


Inspecting a Conflict

var conflictingObjects: [NSManagedObject]

The managed objects that are in conflict.

var conflictingSnapshots: [[AnyHashable : Any]]

The original property values of objects in violation of the constraint.

var constraint: [String]

The constraint that has been violated.

var constraintValues: [String : Any]

The values that the conflicting objects had when the conflict was created.

var databaseObject: NSManagedObject?

The object whose database row is using constraint values.

var databaseSnapshot: [String : Any]?

The values currently stored in the database.


Inherits From

Conforms To

See Also

Conflict Management

class NSMergeConflict

An encapsulation of conflicts that occur during an attempt to save changes in a managed object context.

class NSMergePolicy

A policy object that you use to resolve conflicts between the persistent store and in-memory versions of managed objects.

class NSQueryGenerationToken

A token that indicates which generation of the persistent store is being accessed.