NSMergeConflict Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/CoreData.framework |
| Availability | Available in iOS 5.0 and later. |
| Companion guide | |
| Declared in | NSMergePolicy.h |
Overview
A merge conflict encapsulates conflicts that occur when attempting to save changes in a managed object context.
There are two situations in which a conflict may occur:
Between the managed object context and its in-memory cached state at the persistent store coordinator layer.
In this case, the merge conflict has a source object and a cached snapshot but no persisted snapshot.
Between the cached state at the persistent store coordinator and the external store (file, database, etc.).
In this case, the merge conflict has a cached snapshot and a persisted snapshot. The source object is also provided as a convenience, but it is not directly involved in the conflict.
Snapshot dictionaries include values for all attributes and to-one relationships, but not to-many relationships. Relationship values are NSManagedObjectID references. To-many relationships must be pulled from the persistent store as needed.
Tasks
Initializing a Merge Conflict
-
– initWithSource:newVersion:oldVersion:cachedSnapshot:persistedSnapshot: -
sourceObjectproperty -
objectSnapshotproperty -
cachedSnapshotproperty -
persistedSnapshotproperty -
newVersionNumberproperty -
oldVersionNumberproperty
Properties
cachedSnapshot
A dictionary containing the values of the source object held in the persistent store coordinator layer. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.hnewVersionNumber
The new version number for the change. (read-only)
Discussion
A new version number of 0 means the object was deleted and the corresponding snapshot is nil.
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.hobjectSnapshot
A dictionary containing the values of the source object. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.holdVersionNumber
The old version number for the change. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.hpersistedSnapshot
A dictionary containing the values of the source object held in the persistent store. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.hsourceObject
The source object for the conflict. (read-only)
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.hInstance Methods
initWithSource:newVersion:oldVersion:cachedSnapshot:persistedSnapshot:
Initializes a merge conflict.
Parameters
- srcObject
The source object for the conflict.
- newvers
The new version number for the change.
A value of 0 means the object was deleted and the corresponding snapshot is
nil.- oldvers
The old version number for the change.
- cachesnap
A dictionary containing the values of srcObject held in the persistent store coordinator layer.
- persnap
A dictionary containing the values of srcObject held in the persistent store.
Return Value
A merge conflict object initialized with the given parameters.
Availability
- Available in iOS 5.0 and later.
Declared In
NSMergePolicy.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-10-12)