Class CoreData


  • public final class CoreData
    extends java.lang.Object
    • Field Detail

      • NSFetchRequestExpressionType

        public static final long NSFetchRequestExpressionType
        See Also:
        Constant Field Values
    • Method Detail

      • NSCoreDataVersionNumber

        public static double NSCoreDataVersionNumber()
        Framework version
      • NSDetailedErrorsKey

        public static java.lang.String NSDetailedErrorsKey()
        if multiple validation errors occur in one operation, they are collected in an array and added with this key to the "top-level error" of the operation
      • NSValidationObjectErrorKey

        public static java.lang.String NSValidationObjectErrorKey()
        object that failed to validate for a validation error
      • NSValidationKeyErrorKey

        public static java.lang.String NSValidationKeyErrorKey()
        key that failed to validate for a validation error
      • NSValidationPredicateErrorKey

        public static java.lang.String NSValidationPredicateErrorKey()
        for predicate-based validation, the predicate for the condition that failed to validate
      • NSValidationValueErrorKey

        public static java.lang.String NSValidationValueErrorKey()
        if non-nil, the value for the key that failed to validate for a validation error
      • NSAffectedStoresErrorKey

        public static java.lang.String NSAffectedStoresErrorKey()
        stores prompting an error
      • NSAffectedObjectsErrorKey

        public static java.lang.String NSAffectedObjectsErrorKey()
        objects prompting an error
      • NSPersistentStoreSaveConflictsErrorKey

        public static java.lang.String NSPersistentStoreSaveConflictsErrorKey()
        key in NSError's userInfo specifying the NSArray of NSMergeConflict
      • NSSQLiteErrorDomain

        public static java.lang.String NSSQLiteErrorDomain()
        Predefined domain for SQLite errors, value of "code" will correspond to preexisting values in SQLite.
      • NSManagedObjectContextWillSaveNotification

        public static java.lang.String NSManagedObjectContextWillSaveNotification()
        Notifications immediately before and immediately after the context saves. The user info dictionary contains information about the objects that changed and what changed
      • NSManagedObjectContextDidSaveNotification

        public static java.lang.String NSManagedObjectContextDidSaveNotification()
      • NSManagedObjectContextObjectsDidChangeNotification

        public static java.lang.String NSManagedObjectContextObjectsDidChangeNotification()
        Notification when objects in a context changed: the user info dictionary contains information about the objects that changed and what changed
      • NSInsertedObjectsKey

        public static java.lang.String NSInsertedObjectsKey()
        User info keys for NSManagedObjectContextObjectsDidChangeNotification: the values for these keys are sets of managed objects
      • NSUpdatedObjectsKey

        public static java.lang.String NSUpdatedObjectsKey()
      • NSDeletedObjectsKey

        public static java.lang.String NSDeletedObjectsKey()
      • NSRefreshedObjectsKey

        public static java.lang.String NSRefreshedObjectsKey()
      • NSInvalidatedObjectsKey

        public static java.lang.String NSInvalidatedObjectsKey()
      • NSManagedObjectContextQueryGenerationKey

        public static java.lang.String NSManagedObjectContextQueryGenerationKey()
      • NSInvalidatedAllObjectsKey

        public static java.lang.String NSInvalidatedAllObjectsKey()
        All objects in the context have been invalidated
      • NSErrorMergePolicy

        public static java.lang.Object NSErrorMergePolicy()
        Default policy for all managed object contexts - save returns with an error that contains the object IDs of the objects that had conflicts(NSInsertedObjectsKey, NSUpdatedObjectsKey).
      • NSMergeByPropertyStoreTrumpMergePolicy

        public static java.lang.Object NSMergeByPropertyStoreTrumpMergePolicy()
        This singleton policy merges conflicts between the persistent store's version of the object and the current in memory version. The merge occurs by individual property. For properties which have been changed in both the external source and in memory, the external changes trump the in memory ones.
      • NSMergeByPropertyObjectTrumpMergePolicy

        public static java.lang.Object NSMergeByPropertyObjectTrumpMergePolicy()
        This singleton policy merges conflicts between the persistent store's version of the object and the current in memory version. The merge occurs by individual property. For properties which have been changed in both the external source and in memory, the in memory changes trump the external ones.
      • NSOverwriteMergePolicy

        public static java.lang.Object NSOverwriteMergePolicy()
        This singleton policy overwrites all state for the changed objects in conflict The current object's state is pushed upon the persistent store.
      • NSRollbackMergePolicy

        public static java.lang.Object NSRollbackMergePolicy()
        This singleton policy discards all state for the changed objects in conflict. The persistent store's version of the object is used.
      • NSSQLiteStoreType

        public static java.lang.String NSSQLiteStoreType()
        Persistent store types supported by Core Data:
      • NSBinaryStoreType

        public static java.lang.String NSBinaryStoreType()
      • NSInMemoryStoreType

        public static java.lang.String NSInMemoryStoreType()
      • NSStoreTypeKey

        public static java.lang.String NSStoreTypeKey()
        key in the metadata dictionary to identify the store type
      • NSStoreUUIDKey

        public static java.lang.String NSStoreUUIDKey()
        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 (while the UUID generated for new stores is unique, users can freely copy files and thus the UUID stored inside, so developers that track/reference stores explicitly do 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 their application)
      • NSPersistentStoreCoordinatorStoresWillChangeNotification

        public static java.lang.String NSPersistentStoreCoordinatorStoresWillChangeNotification()
        A notification posted before the list of open persistent stores changes, similar to NSPersistentStoreCoordinatorStoresDidChangeNotification. If the application is running, Core Data will post this before responding to iCloud account changes or "Delete All" from Documents & Data.
      • NSPersistentStoreCoordinatorStoresDidChangeNotification

        public static java.lang.String NSPersistentStoreCoordinatorStoresDidChangeNotification()
        user info dictionary contains information about the stores that were added or removed
      • NSPersistentStoreCoordinatorWillRemoveStoreNotification

        public static java.lang.String NSPersistentStoreCoordinatorWillRemoveStoreNotification()
        sent during the invocation of NSPersistentStore's willRemoveFromPersistentStoreCoordinator during store deallocation or removal
      • NSAddedPersistentStoresKey

        public static java.lang.String NSAddedPersistentStoresKey()
        The object values for NSAddedPersistentStoresKey and NSRemovedPersistentStoresKey will be arrays containing added/removed stores
      • NSRemovedPersistentStoresKey

        public static java.lang.String NSRemovedPersistentStoresKey()
      • NSUUIDChangedPersistentStoresKey

        public static java.lang.String NSUUIDChangedPersistentStoresKey()
        The object value for NSUUIDChangedPersistentStoresKey will be an array where the object at index 0 will be the old store instance, and the object at index 1 the new
      • NSReadOnlyPersistentStoreOption

        public static java.lang.String NSReadOnlyPersistentStoreOption()
        flag indicating whether a store is treated as read-only or not - default is NO
      • NSPersistentStoreTimeoutOption

        public static java.lang.String NSPersistentStoreTimeoutOption()
        Options key specifying the connection timeout for Core Data stores. This value (an NSNumber) represents the duration, in seconds, Core Data will wait while attempting to create a connection to a persistent store. If a connection is unable to be made within that timeframe, the operation is aborted and an error is returned.
      • NSSQLitePragmasOption

        public static java.lang.String 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 strings. 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 visit
      • NSSQLiteAnalyzeOption

        public static java.lang.String 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. Ignored by other stores.
      • NSSQLiteManualVacuumOption

        public static java.lang.String 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. Ignored by other stores.
      • NSIgnorePersistentStoreVersioningOption

        public static java.lang.String NSIgnorePersistentStoreVersioningOption()
        Options key to ignore the built-in versioning provided by Core Data. If the value for this key (an NSNumber) evaluates to YES (using boolValue), 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 is specified by default for all applications linked on or before Mac OS X 10.4.
      • NSMigratePersistentStoresAutomaticallyOption

        public static java.lang.String NSMigratePersistentStoresAutomaticallyOption()
        Options key to automatically attempt to migrate versioned stores. If the value for this key (an NSNumber) evaluates to YES (using boolValue) Core Data will, if the version hash information for added store is determined to be incompatible with the model for the coordinator, attempt to locate the source and mapping models in the application bundles, and perform a migration.
      • NSInferMappingModelAutomaticallyOption

        public static java.lang.String NSInferMappingModelAutomaticallyOption()
        When combined with NSMigratePersistentStoresAutomaticallyOption, coordinator will attempt to infer a mapping model if none can be found
      • NSStoreModelVersionHashesKey

        public static java.lang.String NSStoreModelVersionHashesKey()
        Key to represent the version hash information (dictionary) for the model used to create a persistent store. This key is used in the metadata for a persistent store.
      • NSStoreModelVersionIdentifiersKey

        public static java.lang.String NSStoreModelVersionIdentifiersKey()
        Key to represent the version identifier for the model used to create the store. This key is used in the metadata for a persistent store.
      • NSPersistentStoreOSCompatibility

        public static java.lang.String NSPersistentStoreOSCompatibility()
        Key to represent the earliest version of MacOS X the persistent store should support. Backward compatibility may preclude some features. The numeric values are defined in AvailabilityMacros.h
      • NSPersistentStoreConnectionPoolMaxSizeKey

        public static java.lang.String NSPersistentStoreConnectionPoolMaxSizeKey()
        User info key specifying the maximum connection pool size that should be used on a store that supports concurrent request handling, the value should be an NSNumber. The connection pool size determines the number of requests a store can handle concurrently, and should be a function of how many contexts are attempting to access store data at any time. Generally, application developers should not set this, and should use the default value. The default connection pool size is implementation dependent and may vary by store type and/or platform.
      • NSPersistentStoreForceDestroyOption

        public static java.lang.String NSPersistentStoreForceDestroyOption()
        store option for the destroy... and replace... to indicate that the store file should be destroyed even if the operation might be unsafe (overriding locks
      • NSPersistentStoreFileProtectionKey

        public static java.lang.String NSPersistentStoreFileProtectionKey()
        Key to represent the protection class for the persistent store. Backward compatibility may preclude some features. The acceptable values are those defined in Foundation for the NSFileProtectionKey. The default value of NSPersistentStoreFileProtectionKey is NSFileProtectionCompleteUntilFirstUserAuthentication for all applications built on or after iOS5. The default value for all older applications is NSFileProtectionNone.
      • NSPersistentStoreUbiquitousContentNameKey

        public static java.lang.String NSPersistentStoreUbiquitousContentNameKey()
        option indicating that a persistent store has a given name in ubiquity, this option is required for ubiquity to function
      • NSPersistentStoreUbiquitousContentURLKey

        public static java.lang.String NSPersistentStoreUbiquitousContentURLKey()
        option indicating the log path to use for ubiquity logs, this option is optional for ubiquity, a default path will be generated for the store if none is provided
      • NSPersistentStoreDidImportUbiquitousContentChangesNotification

        public static java.lang.String NSPersistentStoreDidImportUbiquitousContentChangesNotification()
        Notification sent after records are imported from the ubiquity store. The notification is sent with the object set to the NSPersistentStoreCoordinator instance which registered the store.
      • NSPersistentStoreUbiquitousTransitionTypeKey

        public static java.lang.String NSPersistentStoreUbiquitousTransitionTypeKey()
        In the NSPersistentStoreCoordinatorStoresWillChangeNotification / NSPersistentStoreCoordinatorStoresDidChangeNotification userInfo dictionaries, this identifies the type of event. This could be one of the NSPersistentStoreUbiquitousTransitionType enum values as an NSNumber
      • NSPersistentStoreUbiquitousPeerTokenOption

        public static java.lang.String NSPersistentStoreUbiquitousPeerTokenOption()
        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.
      • NSPersistentStoreRemoveUbiquitousMetadataOption

        public static java.lang.String NSPersistentStoreRemoveUbiquitousMetadataOption()
        NSNumber boolean indicating that the receiver should remove all associated ubiquity metadata from a persistent store. This is mostly used during migration or copying to disassociate a persistent store file from an iCloud account
      • NSPersistentStoreUbiquitousContainerIdentifierKey

        public static java.lang.String NSPersistentStoreUbiquitousContainerIdentifierKey()
        NSString specifying the iCloud container identifier Core Data should pass to -URLForUbiquitousContainerIdentifier:
      • NSPersistentStoreRebuildFromUbiquitousContentOption

        public static java.lang.String NSPersistentStoreRebuildFromUbiquitousContentOption()
        NSNumber boolean indicating that the receiver should erase the local store file and rebuild it from the iCloud data in Mobile Documents.
      • NSMigrationManagerKey

        public static java.lang.String NSMigrationManagerKey()
        To access the entity migration policy keys in property mapping value expressions implemented in source code use the constants as declared. To access them in custom value expression strings in the mapping model editor in Xcode follow the syntax rules outlined in the predicate format string syntax guide and refer to them as: NSMigrationManagerKey $manager NSMigrationSourceObjectKey $source NSMigrationDestinationObjectKey $destination NSMigrationEntityMappingKey $entityMapping NSMigrationPropertyMappingKey $propertyMapping NSMigrationEntityPolicyKey $entityPolicy
      • NSMigrationSourceObjectKey

        public static java.lang.String NSMigrationSourceObjectKey()
      • NSMigrationDestinationObjectKey

        public static java.lang.String NSMigrationDestinationObjectKey()
      • NSMigrationEntityMappingKey

        public static java.lang.String NSMigrationEntityMappingKey()
      • NSMigrationPropertyMappingKey

        public static java.lang.String NSMigrationPropertyMappingKey()
      • NSMigrationEntityPolicyKey

        public static java.lang.String NSMigrationEntityPolicyKey()
      • NSCoreDataCoreSpotlightExporter

        public static java.lang.String NSCoreDataCoreSpotlightExporter()
        Spotlight indexing and external record support keys
      • NSPersistentHistoryTrackingKey

        public static java.lang.String NSPersistentHistoryTrackingKey()
        Dictionary key for enabling persistent history - default is NO
      • NSBinaryStoreSecureDecodingClasses

        public static java.lang.String NSBinaryStoreSecureDecodingClasses()
        Allows developers to provide an additional set of classes (which must implement NSSecureCoding) that should be used while decoding a binary store. Using this option is preferable to using NSBinaryStoreInsecureDecodingCompatibilityOption.
      • NSBinaryStoreInsecureDecodingCompatibilityOption

        public static java.lang.String NSBinaryStoreInsecureDecodingCompatibilityOption()
        Indicate that the binary store should be decoded insecurely. This may be necessary if a store has metadata or transformable properties containing non-standard classes. If possible, developers should use the NSBinaryStoreSecureDecodingClasses option to specify the contained classes, allowing the binary store to to be securely decoded. Applications linked before the availability date will default to using this option.
      • NSPersistentStoreRemoteChangeNotificationPostOptionKey

        public static java.lang.String NSPersistentStoreRemoteChangeNotificationPostOptionKey()
        When NSPersistentStoreRemoteChangeNotificationPostOptionKey is set to YES, a NSPersistentStoreRemoteChangeNotification is posted for every write to the store, this includes writes that are done by other processes
      • NSPersistentStoreRemoteChangeNotification

        public static java.lang.String NSPersistentStoreRemoteChangeNotification()
        NSPersistentStoreRemoteChangeNotification is posted for all cross process writes to the store The payload is the store UUID (NSStoreUUIDKey), store URL (NSPersistentStoreURLKey), and NSPersistentHistoryToken for the transaction (if NSPersistentHistoryTrackingKey was also set)
      • NSPersistentStoreURLKey

        public static java.lang.String NSPersistentStoreURLKey()
        Keys found in the UserInfo for a NSPersistentStoreRemoteChangeNotification
      • NSPersistentHistoryTokenKey

        public static java.lang.String NSPersistentHistoryTokenKey()
      • NSManagedObjectContextDidSaveObjectIDsNotification

        public static java.lang.String NSManagedObjectContextDidSaveObjectIDsNotification()
        Notification when objects in a context changed: the user info dictionary contains information about the objectIDs that changed
      • NSManagedObjectContextDidMergeChangesObjectIDsNotification

        public static java.lang.String NSManagedObjectContextDidMergeChangesObjectIDsNotification()
      • NSInsertedObjectIDsKey

        public static java.lang.String NSInsertedObjectIDsKey()
        User info keys for NSManagedObjectContextDidSaveObjectIDsNotification: the values for these keys are sets of objectIDs
      • NSUpdatedObjectIDsKey

        public static java.lang.String NSUpdatedObjectIDsKey()
      • NSDeletedObjectIDsKey

        public static java.lang.String NSDeletedObjectIDsKey()
      • NSRefreshedObjectIDsKey

        public static java.lang.String NSRefreshedObjectIDsKey()
      • NSInvalidatedObjectIDsKey

        public static java.lang.String NSInvalidatedObjectIDsKey()
      • NSPersistentCloudKitContainerEventChangedNotification

        public static java.lang.String NSPersistentCloudKitContainerEventChangedNotification()
      • NSPersistentCloudKitContainerEventUserInfoKey

        public static java.lang.String NSPersistentCloudKitContainerEventUserInfoKey()