NSIncrementalStoreNode Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreData.framework
Availability
Available in OS X v10.7 and later.
Companion guide
Declared in
NSIncrementalStoreNode.h

Overview

NSIncrementalStoreNode is a concrete class to represent basic nodes in a Core Data incremental store.

A node represents a single record in a persistent store.

You can subclass NSIncrementalStoreNode to provide custom behavior.

Tasks

Designated Initializer

Managing Node Data

Instance Methods

initWithObjectID:withValues:version:

Returns an object initialized with the given values.

- (id)initWithObjectID:(NSManagedObjectID *)objectID withValues:(NSDictionary *)values version:(uint64_t)version
Parameters
objectID

A managed object ID.

values

A dictionary containing the values persisted in an external store with keys corresponding to the names of the property description in the NSEntityDescription object described by objectID:

  • For attributes: an immutable value (an instance of a value class such as NSNumber, NSString, NSData). Missing attribute keys will assume a nil value.

  • For to-one relationships: the managed object ID of the related object or an instance of NSNull for nil relationship values. A missing key will be resolved lazily through calling newValueForRelationship:forObjectWithID:withContext:error: on the NSPersistentStore object. Lazy resolution for to-one relationships is discouraged.

  • For to-many relationships: an instance of NSArray or NSSet containing the managed object IDs of the related objects. Empty to-many relationships must be represented by an empty non-nil collection. A missing key will be resolved lazily through calling newValueForRelationship:forObjectWithID:withContext:error: on the NSPersistentStore object. Lazy resolution for to-many relationships is encouraged.

Unknown or unmodeled keys are stripped out.

version

The revision number of this state. This value is used for conflict detection and merging.

Return Value

An object initialized with the given values.

Discussion

Availability
  • Available in OS X v10.7 and later.
Declared In
NSIncrementalStoreNode.h

objectID

Returns the object ID that identifies the data stored by the receiver.

- (NSManagedObjectID *)objectID
Return Value

The object ID that identifies the data stored by the receiver.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSIncrementalStoreNode.h

updateWithValues:version:

Update the values and version to reflect new data being saved to or loaded from the external store.

- (void)updateWithValues:(NSDictionary *)values version:(uint64_t)version
Parameters
values

A dictionary containing updated values, in the same format as that described in initWithObjectID:withValues:version:.

version

The version number for the transaction.

Discussion

Update the values and version to reflect new data being saved to or loaded from the external store. // The values dictionary is in the same format as the initializer

Availability
  • Available in OS X v10.7 and later.
Declared In
NSIncrementalStoreNode.h

valueForPropertyDescription:

Returns the value for the given property.

- (id)valueForPropertyDescription:(NSPropertyDescription *)prop
Parameters
prop

A property description for one of the properties in the receiver.

Return Value

The value for the property specified by prop. May return an instance of NSNull for to-one relationships.

Discussion

If a relationship is nil, you should create a new value by invoking newValueForRelationship:forObjectWithID:withContext:error: on the NSPersistentStore object.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSIncrementalStoreNode.h

version

Return the version of data in the receiver.

- (uint64_t)version
Return Value

The version of data in the receiver.

Discussion

The version number is used by the persistent store coordinator to detect and handle merge conflicts. The version number should be stored with the record. The version number should (implicitly) start at zero (where zero indicates an unsaved object in memory) and be incremented by exactly one every time you save. In addition, you increment the version number when you or the Core Data framework have marked the associated managed object for optimistic locking.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSIncrementalStoreNode.h