Mac Developer Library

Developer

CoreData Framework Reference NSPersistentStoreCoordinator Class Reference

Options
Deployment Target:

On This Page
Language:

NSPersistentStoreCoordinator

Inheritance


Conforms To


Import Statement


Swift

import CoreData

Objective-C

@import CoreData;

Availability


Available in OS X v10.4 and later.

Instances of NSPersistentStoreCoordinator associate persistent stores (by type) with a model (or more accurately, a configuration of a model) and serve to mediate between the persistent store or stores and the managed object context or contexts. Instances of NSManagedObjectContext use a coordinator to save object graphs to persistent storage and to retrieve model information. A context without a coordinator is not fully functional as it cannot access a model except through a coordinator. The coordinator is designed to present a façade to the managed object contexts such that a group of persistent stores appears as an aggregate store. A managed object context can then create an object graph based on the union of all the data stores the coordinator covers.

Coordinators do the opposite of providing for concurrency—€”they serialize operations. If you want to use multiple threads for different write operations you use multiple coordinators. Note that if multiple threads work directly with a coordinator, they need to lock and unlock it explicitly.

Each coordinator (and thus container) may use different copies, and hence different versions, of a managed object model. This allows you to cleanly deal with file versioning.

The coordinator gives access to its underlying object stores. You can retrieve an object store when you first add one (using addPersistentStoreWithType:configuration:URL:options:error:), or by using persistentStoreForURL: or persistentStores. This allows you to to determine, for example, whether a store has already been added, or whether two objects come from the same store.

For more details about these tasks, see Using Persistent Stores in Core Data Programming Guide.

  • Returns a dictionary of the registered store types.

    Declaration

    Swift

    class func registeredStoreTypes() -> [NSObject : AnyObject]

    Objective-C

    + (NSDictionary *)registeredStoreTypes

    Return Value

    A dictionary of the registered store types—the keys are the store type strings, and the values are the NSPersistentStore subclasses.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.5 and later.

  • Registers a given NSPersistentStore subclass for a given store type string.

    Declaration

    Swift

    class func registerStoreClass(_ storeClass: AnyClass?, forStoreType storeType: String)

    Objective-C

    + (void)registerStoreClass:(Class)storeClass forStoreType:(NSString *)storeType

    Parameters

    storeClass

    The NSPersistentStore subclass to use for the store of type storeType.

    storeType

    A unique string that identifies a store type.

    Discussion

    You must invoke this method before a custom subclass of NSPersistentStore can be loaded into a persistent store coordinator.

    You can pass nil for storeClass to unregister the store type.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.5 and later.

  • Initializes the receiver with a managed object model.

    Declaration

    Swift

    init(managedObjectModel model: NSManagedObjectModel)

    Objective-C

    - (instancetype)initWithManagedObjectModel:(NSManagedObjectModel *)model

    Parameters

    model

    A managed object model.

    Return Value

    The receiver, initialized with model.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

  • The receiver’s managed object model. (read-only)

    Declaration

    Swift

    var managedObjectModel: NSManagedObjectModel { get }

    Objective-C

    @property(readonly, strong) NSManagedObjectModel *managedObjectModel

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

  • Deletes all ubiquitous content for all peers for the persistent store at a given URL and also delete the local store file.

    Declaration

    Swift

    class func removeUbiquitousContentAndPersistentStoreAtURL(_ storeURL: NSURL, options options: [NSObject : AnyObject]?, error error: NSErrorPointer) -> Bool

    Objective-C

    + (BOOL)removeUbiquitousContentAndPersistentStoreAtURL:(NSURL *)storeURL options:(NSDictionary *)options error:(NSError **)error

    Parameters

    storeURL

    The URL of the store to delete.

    options

    A dictionary containing the options normally passed to addPersistentStoreWithType:configuration:URL:options:error:.

    error

    If the operation fails, upon return contains an NSError object that describes the problem.

    Return Value

    YEStrue if the store was deleted, otherwise NOfalse.

    Discussion

    Errors may be returned as a result of file I/O, iCloud network or iCloud account issues.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.9 and later.

  • Sends a request to all the persistent stores associated with the receiver.

    Declaration

    Swift

    func executeRequest(_ request: NSPersistentStoreRequest, withContext context: NSManagedObjectContext, error error: NSErrorPointer) -> AnyObject?

    Objective-C

    - (id)executeRequest:(NSPersistentStoreRequest *)request withContext:(NSManagedObjectContext *)context error:(NSError **)error

    Parameters

    request

    A fetch or save request.

    context

    The context against which request should be executed.

    error

    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    An array containing managed objects, managed object IDs, or dictionaries as appropriate for a fetch request; an empty array if request is a save request, or nil if an error occurred.

    User defined requests return arrays of arrays, where a nested array is the result returned from a single store.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.7 and later.

  • lock() - lock (OS X v10.10)

    Attempts to acquire a lock.

    Declaration

    Swift

    func lock()

    Objective-C

    - (void)lock

    Discussion

    This method blocks a thread’€™s execution until the lock can be acquired. An application protects a critical section of code by requiring a thread to acquire a lock before executing the code. Once the critical section is past, the thread relinquishes the lock by invoking unlock.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

    Deprecated in OS X v10.10.

  • tryLock() - tryLock (OS X v10.10)

    Attempts to acquire a lock.

    Declaration

    Swift

    func tryLock() -> Bool

    Objective-C

    - (BOOL)tryLock

    Return Value

    YEStrue if successful, otherwise NOfalse.

    Discussion

    Returns immediately—contrast lock which blocks.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

    Deprecated in OS X v10.10.

  • unlock() - unlock (OS X v10.10)

    Relinquishes a previously acquired lock.

    Declaration

    Swift

    func unlock()

    Objective-C

    - (void)unlock

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

    Deprecated in OS X v10.10.

  • Returns a dictionary containing the parsed elements derived from the Spotlight external record file specified by the given URL.

    Declaration

    Swift

    class func elementsDerivedFromExternalRecordURL(_ fileURL: NSURL) -> [NSObject : AnyObject]

    Objective-C

    + (NSDictionary *)elementsDerivedFromExternalRecordURL:(NSURL *)fileURL

    Parameters

    fileURL

    A file URL specifying the location of a Spotlight external record file.

    Return Value

    A dictionary containing the parsed elements derived from the Spotlight support file specified by fileURL.

    Discussion

    Dictionary keys and the corresponding values are described in Spotlight External Record Elements.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.6 and later.

  • Creates and populates a store with the external records found at a given URL.

    Declaration

    Swift

    func importStoreWithIdentifier(_ storeIdentifier: String?, fromExternalRecordsDirectory externalRecordsURL: NSURL, toURL destinationURL: NSURL, options options: [NSObject : AnyObject]?, withType storeType: String, error error: NSErrorPointer) -> NSPersistentStore?

    Objective-C

    - (NSPersistentStore *)importStoreWithIdentifier:(NSString *)storeIdentifier fromExternalRecordsDirectory:(NSURL *)externalRecordsURL toURL:(NSURL *)destinationURL options:(NSDictionary *)options withType:(NSString *)storeType error:(NSError **)error

    Parameters

    storeIdentifier

    The identifier for a store.

    If this value is nil then the method imports the records for the first store found.

    externalRecordsURL

    The location of the directory containing external records.

    destinationURL

    An URL object that specifies the location for the new store.

    There should be no existing store at this location, as the store will be created from scratch (appending to an existing store is not allowed).

    options

    A dictionary containing key-value pairs that specify whether the store should be read-only, and whether (for an XML store) the XML file should be validated against the DTD before it is read. For key definitions, see Store Options.

    storeType

    A string constant (such as NSSQLiteStoreType) that specifies the type of the new store—see Store Types.

    error

    If an error occurs, upon return contains an instance of NSError that describes the problem.

    Return Value

    An object representing the newly-created store.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.6 and later.

  • Returns an object ID for the specified URI representation of an object ID if a matching store is available, or nil if a matching store cannot be found.

    Declaration

    Swift

    func managedObjectIDForURIRepresentation(_ URL: NSURL) -> NSManagedObjectID?

    Objective-C

    - (NSManagedObjectID *)managedObjectIDForURIRepresentation:(NSURL *)URL

    Parameters

    URL

    An URL object containing a URI that specify a managed object.

    Return Value

    An object ID for the object specified by URL.

    Discussion

    The URI representation contains a UUID of the store the ID is coming from, and the coordinator can match it against the stores added to it.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.4 and later.

    See Also

    URIRepresentation (NSManagedObjectID)
    objectWithID: (NSManagedObjectContext)

  • Types of persistent store.

    Declaration

    Swift

    let NSSQLiteStoreType: String let NSXMLStoreType: String let NSBinaryStoreType: String let NSInMemoryStoreType: String

    Objective-C

    NSString * const NSSQLiteStoreType; NSString * const NSXMLStoreType; NSString * const NSBinaryStoreType; NSString * const NSInMemoryStoreType;

    Constants

    • NSSQLiteStoreType

      NSSQLiteStoreType

      The SQLite database store type.

      Available in OS X v10.4 and later.

    • NSXMLStoreType

      NSXMLStoreType

      The XML store type.

      Available in OS X v10.4 and later.

    • NSBinaryStoreType

      NSBinaryStoreType

      The binary store type.

      Available in OS X v10.4 and later.

    • NSInMemoryStoreType

      NSInMemoryStoreType

      The in-memory store type.

      Available in OS X v10.4 and later.

  • Keys used in a store’€™s metadata dictionary.

    Declaration

    Swift

    let NSStoreTypeKey: String let NSStoreUUIDKey: String

    Objective-C

    NSString * const NSStoreTypeKey; NSString * const NSStoreUUIDKey;

    Constants

    • NSStoreTypeKey

      NSStoreTypeKey

      The key in the metadata dictionary to identify the store type.

      Available in OS X v10.4 and later.

    • NSStoreUUIDKey

      NSStoreUUIDKey

      The key in the metadata dictionary to identify the store UUID.

      The store UUID is useful to identify stores through URI representations, but it is not guaranteed to be unique. The UUID generated for new stores is unique—users can freely copy files and thus the UUID stored inside—so if you track or reference stores explicitly you need to be aware of duplicate UUIDs and potentially override the UUID when a new store is added to the list of known stores in your application.

      Available in OS X v10.4 and later.

  • An NSPersistentStoreCoordinatorStoresDidChangeNotification notification is posted whenever persistent stores are added to or removed from a persistent store coordinator, or when store UUIDs change. The userInfo dictionary contains information about the stores that were added or removed using these keys.

    Declaration

    Swift

    let NSAddedPersistentStoresKey: String let NSRemovedPersistentStoresKey: String let NSUUIDChangedPersistentStoresKey: String let NSPersistentStoreUbiquitousTransitionTypeKey: String

    Objective-C

    NSString * const NSAddedPersistentStoresKey; NSString * const NSRemovedPersistentStoresKey; NSString * const NSUUIDChangedPersistentStoresKey; NSString * const NSPersistentStoreUbiquitousTransitionTypeKey;

    Constants

    • NSAddedPersistentStoresKey

      NSAddedPersistentStoresKey

      Key for the array of stores that were added.

      Available in OS X v10.4 and later.

    • NSRemovedPersistentStoresKey

      NSRemovedPersistentStoresKey

      Key for the array of stores that were removed.

      Available in OS X v10.4 and later.

    • NSUUIDChangedPersistentStoresKey

      NSUUIDChangedPersistentStoresKey

      Key for an array containing the old and new stores.

      The object at index 0 is the old store instance, and the object at index 1 the new. When migration happens, the array contains a third object (at index 2) that is an array containing the new objectIDs for all the migrated objects.

      Available in OS X v10.4 and later.

    • NSPersistentStoreUbiquitousTransitionTypeKey

      NSPersistentStoreUbiquitousTransitionTypeKey

      In the NSPersistentStoreCoordinatorStoresWillChangeNotification and NSPersistentStoreCoordinatorStoresDidChangeNotification userInfo dictionaries, this identifies the type of event. The corresponding value is one of the NSPersistentStoreUbiquitousTransitionType enum values as an NSNumber object.

      Available in OS X v10.9 and later.

  • Declaration

    Swift

    let NSReadOnlyPersistentStoreOption: String let NSValidateXMLStoreOption: String let NSPersistentStoreTimeoutOption: String let NSSQLitePragmasOption: String let NSSQLiteAnalyzeOption: String let NSSQLiteManualVacuumOption: String let NSExternalRecordsDirectoryOption: String let NSExternalRecordExtensionOption: String let NSExternalRecordsFileFormatOption: String let NSPersistentStoreUbiquitousContentNameKey: String let NSPersistentStoreUbiquitousContentURLKey: String let NSPersistentStoreUbiquitousPeerTokenOption: String let NSPersistentStoreRemoveUbiquitousMetadataOption: String let NSPersistentStoreUbiquitousContainerIdentifierKey: String let NSPersistentStoreRebuildFromUbiquitousContentOption: String

    Objective-C

    NSString * const NSReadOnlyPersistentStoreOption; NSString * const NSValidateXMLStoreOption; NSString * const NSPersistentStoreTimeoutOption; NSString * const NSSQLitePragmasOption; NSString * const NSSQLiteAnalyzeOption; NSString * const NSSQLiteManualVacuumOption; NSString * const NSExternalRecordsDirectoryOption; NSString * const NSExternalRecordExtensionOption; NSString * const NSExternalRecordsFileFormatOption; NSString * const NSPersistentStoreUbiquitousContentNameKey; NSString * const NSPersistentStoreUbiquitousContentURLKey; NSString * const NSPersistentStoreUbiquitousPeerTokenOption; NSString * const NSPersistentStoreRemoveUbiquitousMetadataOption; NSString * const NSPersistentStoreUbiquitousContainerIdentifierKey; NSString * const NSPersistentStoreRebuildFromUbiquitousContentOption;

    Constants

    • NSReadOnlyPersistentStoreOption

      NSReadOnlyPersistentStoreOption

      A flag that indicates whether a store is treated as read-only or not.

      The default value is NOfalse.

      Available in OS X v10.4 and later.

    • NSValidateXMLStoreOption

      NSValidateXMLStoreOption

      A flag that indicates whether an XML file should be validated with the DTD while opening.

      The default value is NOfalse.

      Available in OS X v10.4 and later.

    • NSPersistentStoreTimeoutOption

      NSPersistentStoreTimeoutOption

      Options key that specifies the connection timeout for Core Data stores.

      The corresponding value is an NSNumber object that represents the duration in seconds that Core Data will wait while attempting to create a connection to a persistent store. If a connection is cannot be made within that timeframe, the operation is aborted and an error is returned.

      Available in OS X v10.5 and later.

    • NSSQLitePragmasOption

      NSSQLitePragmasOption

      Options key for a dictionary of SQLite pragma settings with pragma values indexed by pragma names as keys.

      All pragma values must be specified as NSString objects. The fullfsync and synchronous pragmas control the tradeoff between write performance (write to disk speed & cache utilization) and durability (data loss/corruption sensitivity to power interruption). For more information on pragma settings, see http://sqlite.org/pragma.html.

      Available in OS X v10.5 and later.

    • NSSQLiteAnalyzeOption

      NSSQLiteAnalyzeOption

      Option key to run an analysis of the store data to optimize indices based on statistical information when the store is added to the coordinator.

      This invokes SQLite's ANALYZE command. It is ignored by stores other than the SQLite store.

      Available in OS X v10.5 and later.

    • NSSQLiteManualVacuumOption

      NSSQLiteManualVacuumOption

      Option key to rebuild the store file, forcing a database wide defragmentation when the store is added to the coordinator.

      This invokes SQLite's VACUUM command. It is ignored by stores other than the SQLite store.

      Available in OS X v10.6 and later.

    • NSExternalRecordsDirectoryOption

      NSExternalRecordsDirectoryOption

      Option indicating the directory where Spotlight external record files should be written to.

      Available in OS X v10.6 and later.

    • NSExternalRecordExtensionOption

      NSExternalRecordExtensionOption

      Option indicating the file extension to use for Spotlight external record files.

      Available in OS X v10.6 and later.

    • NSExternalRecordsFileFormatOption

      NSExternalRecordsFileFormatOption

      Option to specify the file format of a Spotlight external records.

      For possible values, see Spotlight External Record File Format Options.

      Available in OS X v10.6 and later.

    • NSPersistentStoreUbiquitousContentNameKey

      NSPersistentStoreUbiquitousContentNameKey

      Option to specify that a persistent store has a given name in ubiquity.

      This option is required for ubiquitous content to function.

      Available in OS X v10.7 and later.

    • NSPersistentStoreUbiquitousContentURLKey

      NSPersistentStoreUbiquitousContentURLKey

      Option to specify the log path to use for ubiquitous content logs.

      In iOS 6 and OS X 10.8 and below, this option is required for ubiquitous content to function. In iOS 7 and OS X 10.9 and later, it is optional.

      Available in OS X v10.7 and later.

    • NSPersistentStoreUbiquitousPeerTokenOption

      NSPersistentStoreUbiquitousPeerTokenOption

      The corresponding value is an optionally specified string which will be mixed in to Core Data’s identifier for each iCloud peer. The value must be an alphanumeric string without any special characters, whitespace or punctuation. The primary use for this option is to allow multiple applications on the same peer (device) to share a Core Data store integrated with iCloud. Each application will require its own store file.

      Available in OS X v10.9 and later.

    • NSPersistentStoreRemoveUbiquitousMetadataOption

      NSPersistentStoreRemoveUbiquitousMetadataOption

      The corresponding value is an NSNumber object representing a boolean that indicates whether the receiver should remove all associated ubiquity metadata from a persistent store. You typically use this option during migration or copying to disassociate a persistent store file from an iCloud account.

      Available in OS X v10.9 and later.

    • NSPersistentStoreUbiquitousContainerIdentifierKey

      NSPersistentStoreUbiquitousContainerIdentifierKey

      The corresponding value is a string specifying the iCloud container identifier Core Data should pass to URLForUbiquityContainerIdentifier:.

      Available in OS X v10.9 and later.

    • NSPersistentStoreRebuildFromUbiquitousContentOption

      NSPersistentStoreRebuildFromUbiquitousContentOption

      The corresponding value is an NSNumber object representing a boolean that indicates whether the receiver should erase the local store file and rebuild it from the iCloud data in Mobile Documents.

      Available in OS X v10.9 and later.

  • Migration options, specified in the dictionary of options when adding a persistent store using addPersistentStoreWithType:configuration:URL:options:error:.

    Declaration

    Swift

    let NSIgnorePersistentStoreVersioningOption: String let NSMigratePersistentStoresAutomaticallyOption: String let NSInferMappingModelAutomaticallyOption: String

    Objective-C

    NSString * const NSIgnorePersistentStoreVersioningOption; NSString * const NSMigratePersistentStoresAutomaticallyOption; NSString * const NSInferMappingModelAutomaticallyOption;

    Constants

    • NSIgnorePersistentStoreVersioningOption

      NSIgnorePersistentStoreVersioningOption

      Key to ignore the built-in versioning provided by Core Data.

      The corresponding value is an NSNumber object. If the boolValue of the number is YEStrue, Core Data will not compare the version hashes between the managed object model in the coordinator and the metadata for the loaded store. (It will, however, continue to update the version hash information in the metadata.) This key and corresponding value of YEStrue is specified by default for all applications linked on or before OS X v10.4.

      Available in OS X v10.5 and later.

    • NSMigratePersistentStoresAutomaticallyOption

      NSMigratePersistentStoresAutomaticallyOption

      Key to automatically attempt to migrate versioned stores.

      The corresponding value is an NSNumber object. If the boolValue of the number is YEStrue and if the version hash information for the added store is determined to be incompatible with the model for the coordinator, Core Data will attempt to locate the source and mapping models in the application bundles, and perform a migration.

      Available in OS X v10.5 and later.

    • NSInferMappingModelAutomaticallyOption

      NSInferMappingModelAutomaticallyOption

      Key to attempt to create the mapping model automatically.

      The corresponding value is an NSNumber object. If the boolValue of the number is YEStrue and the value of the NSMigratePersistentStoresAutomaticallyOption is YEStrue, the coordinator will attempt to infer a mapping model if none can be found.

      Available in OS X v10.6 and later.

  • Keys in store metadata to support versioning.

    Declaration

    Swift

    let NSStoreModelVersionHashesKey: String let NSStoreModelVersionIdentifiersKey: String let NSPersistentStoreOSCompatibility: String

    Objective-C

    NSString * const NSStoreModelVersionHashesKey; NSString * const NSStoreModelVersionIdentifiersKey; NSString * const NSPersistentStoreOSCompatibility;

    Constants

    • NSStoreModelVersionHashesKey

      NSStoreModelVersionHashesKey

      Key to represent the version hash information for the model used to create the store.

      This key is used in the metadata for a persistent store.

      Available in OS X v10.5 and later.

    • NSStoreModelVersionIdentifiersKey

      NSStoreModelVersionIdentifiersKey

      Key to represent the version identifiers for the model used to create the store.

      If you add your own annotations to a model’s version identifier (see versionIdentifiers), they are stored in the persistent store’s metadata. You can use this key to retrieve the identifiers from the metadata dictionaries available from NSPersistentStore (metadata) and NSPersistentStoreCoordinator (metadataForPersistentStore: and related methods). The corresponding value is a Foundation collection (an NSArray or NSSet object).

      Available in OS X v10.5 and later.

    • NSPersistentStoreOSCompatibility

      NSPersistentStoreOSCompatibility

      Key to represent the earliest version of the operation system that the persistent store supports.

      The corresponding value is an NSNumber object that takes the form of the constants defined by the availability macros defined in /usr/include/AvailabilityMacros.h; for example 1040 represents OS X version 10.4.0.

      Backward compatibility may preclude some features.

      Available in OS X v10.5 and later.

  • These constants are used as the value corresponding to the NSPersistentStoreUbiquitousTransitionTypeKey in the user info dictionary of NSPersistentStoreCoordinatorStoresWillChangeNotification and NSPersistentStoreCoordinatorStoresDidChangeNotification notifications to identify the type of event leading to a change.

    Declaration

    Swift

    enum NSPersistentStoreUbiquitousTransitionType : UInt { case AccountAdded case AccountRemoved case ContentRemoved case InitialImportCompleted }

    Objective-C

    typedef NS_ENUM (NSUInteger, NSPersistentStoreUbiquitousTransitionType ) { NSPersistentStoreUbiquitousTransitionTypeAccountAdded, NSPersistentStoreUbiquitousTransitionTypeAccountRemoved, NSPersistentStoreUbiquitousTransitionTypeContentRemoved, NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted };

    Constants

    • AccountAdded

      NSPersistentStoreUbiquitousTransitionTypeAccountAdded

      This value indicates that a new iCloud account is available, and the persistent store in use will or did transition to the new account.

      It is only possible to discern this state when the application is running, and therefore this transition type will only be posted if the account changes while the application is running or in the background.

      Available in OS X v10.9 and later.

    • AccountRemoved

      NSPersistentStoreUbiquitousTransitionTypeAccountRemoved

      This value indicates that no iCloud account is available, and the persistent store in use will or did transition to the “local” store.

      It is only possible to discern this state when the application is running, and therefore this transition type will only be posted if the account is removed while the application is running or in the background.

      Available in OS X v10.9 and later.

    • ContentRemoved

      NSPersistentStoreUbiquitousTransitionTypeContentRemoved

      This value indicates that the user has wiped the contents of the iCloud account, usually using Delete All from Documents & Data in Settings.

      The Core Data integration will transition to an empty store file as a result of this event.

      Available in OS X v10.9 and later.

    • InitialImportCompleted

      NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted

      This value indicates that the Core Data integration has finished building a store file that is consistent with the contents of the iCloud account, and is ready to replace the fallback store with that file.

      Available in OS X v10.9 and later.

    Import Statement

    Objective-C

    @import CoreData;

    Swift

    import CoreData

    Availability

    Available in OS X v10.9 and later.

  • Constants that specify the format for Spotlight external records. These constants are the possible values for the key NSPersistentStoreFileProtectionKey.

    Declaration

    Swift

    let NSXMLExternalRecordType: String let NSBinaryExternalRecordType: String

    Objective-C

    NSString * const NSXMLExternalRecordType; NSString * const NSBinaryExternalRecordType;

    Constants

    • NSXMLExternalRecordType

      NSXMLExternalRecordType

      Specifies an XML file format.

      Available in OS X v10.6 and later.

    • NSBinaryExternalRecordType

      NSBinaryExternalRecordType

      Specifies a binary file format

      Available in OS X v10.6 and later.

  • Keys for the dictionary with the parsed elements derived from Spotlight external record file.

    Declaration

    Swift

    let NSEntityNameInPathKey: String let NSStoreUUIDInPathKey: String let NSStorePathKey: String let NSModelPathKey: String let NSObjectURIKey: String

    Objective-C

    NSString * const NSEntityNameInPathKey; NSString * const NSStoreUUIDInPathKey; NSString * const NSStorePathKey; NSString * const NSModelPathKey; NSString * const NSObjectURIKey;

    Constants

    • NSEntityNameInPathKey

      NSEntityNameInPathKey

      Dictionary key for the entity name extracted from an external record file.

      Available in OS X v10.6 and later.

    • NSStoreUUIDInPathKey

      NSStoreUUIDInPathKey

      Dictionary key for the store UUID extracted from an external record file.

      Available in OS X v10.6 and later.

    • NSStorePathKey

      NSStorePathKey

      Dictionary key for the store path (an instance of NSURL) extracted from an external record file.

      This is resolved to the store-file path contained in the an external record file directory.

      Available in OS X v10.6 and later.

    • NSModelPathKey

      NSModelPathKey

      Dictionary key for the managed object model path (an instance of NSURL) extracted from an external record file.

      This is resolved to the model.mom path contained in the external record file directory.

      Available in OS X v10.6 and later.

    • NSObjectURIKey

      NSObjectURIKey

      Dictionary key for the object URI extracted from an external record file.

      Available in OS X v10.6 and later.