iOS Developer Library

Developer

CoreData Framework Reference NSIncrementalStoreNode Class Reference

Options
Deployment Target:

On This Page
Language:

NSIncrementalStoreNode

Inheritance


Conforms To


Import Statement


Swift

import CoreData

Objective-C

@import CoreData;

Availability


Available in iOS 5.0 and later.

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.

  • Returns an object initialized with the given values.

    Declaration

    Swift

    init(objectID objectID: NSManagedObjectID, withValues values: [NSObject : AnyObject], version version: UInt64)

    Objective-C

    - (instancetype)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.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in iOS 5.0 and later.

  • objectID objectID Property

    The object ID that identifies the data stored by the receiver. (read-only)

    Declaration

    Swift

    var objectID: NSManagedObjectID { get }

    Objective-C

    @property(nonatomic, readonly, strong) NSManagedObjectID *objectID

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    func updateWithValues(_ values: [NSObject : AnyObject], version version: UInt64)

    Objective-C

    - (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

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in iOS 5.0 and later.

  • Returns the value for the given property.

    Declaration

    Swift

    func valueForPropertyDescription(_ prop: NSPropertyDescription) -> AnyObject?

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in iOS 5.0 and later.

  • version version Property

    The version of data in the receiver. (read-only)

    Declaration

    Swift

    var version: UInt64 { get }

    Objective-C

    @property(nonatomic, readonly) uint64_t version

    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.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in iOS 5.0 and later.