Core Data Constants Reference

Framework
CoreData/CoreData.h
Declared in
CoreDataDefines.h
CoreDataErrors.h

Overview

This document describes the constants defined in the Core Data framework and not described in a document for an individual class.

Constants

Error User Info Keys

Keys in the user info dictionary in errors Core Data creates.

const NSString *NSDetailedErrorsKey;
const NSString *NSValidationObjectErrorKey;
const NSString *NSValidationKeyErrorKey;
const NSString *NSValidationPredicateErrorKey;
const NSString *NSValidationValueErrorKey;
const NSString *NSAffectedStoresErrorKey;
const NSString *NSAffectedObjectsErrorKey;
const NSString *NSPersistentStoreSaveConflictsErrorKey;
Constants
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.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationObjectErrorKey

Key for the object that failed to validate for a validation error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationKeyErrorKey

Key for the key that failed to validate for a validation error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationPredicateErrorKey

For predicate-based validation, key for the predicate for the condition that failed to validate.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationValueErrorKey

If non-nil, the key for the value for the key that failed to validate for a validation error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSAffectedStoresErrorKey

The key for stores prompting an error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSAffectedObjectsErrorKey

The key for objects prompting an error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreSaveConflictsErrorKey

The key for the array of merge conflict objects (instances of NSMergeConflict).

Available in OS X v10.7 and later.

Declared in CoreDataErrors.h.

Error Domain

Constant to identify the SQLite error domain.

const NSString *NSSQLiteErrorDomain;
Constants
NSSQLiteErrorDomain

Domain for SQLite errors.

The value of "code" corresponds to preexisting values in SQLite.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

Validation Error Codes

Error codes related to validation.

NSManagedObjectValidationError                   = 1550,
NSValidationMultipleErrorsError                  = 1560,
NSValidationMissingMandatoryPropertyError        = 1570,
NSValidationRelationshipLacksMinimumCountError   = 1580,
NSValidationRelationshipExceedsMaximumCountError = 1590,
NSValidationRelationshipDeniedDeleteError        = 1600,
NSValidationNumberTooLargeError                  = 1610,
NSValidationNumberTooSmallError                  = 1620,
NSValidationDateTooLateError                     = 1630,
NSValidationDateTooSoonError                     = 1640,
NSValidationInvalidDateError                     = 1650,
NSValidationStringTooLongError                   = 1660,
NSValidationStringTooShortError                  = 1670,
NSValidationStringPatternMatchingError           = 1680,
Constants
NSManagedObjectValidationError

Error code to denote a generic validation error.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationMultipleErrorsError

Error code to denote an error containing multiple validation errors.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationMissingMandatoryPropertyError

Error code for a non-optional property with a nil value.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationRelationshipLacksMinimumCountError

Error code to denote a to-many relationship with too few destination objects.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationRelationshipExceedsMaximumCountError

Error code to denote a bounded to-many relationship with too many destination objects.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationRelationshipDeniedDeleteError

Error code to denote some relationship with delete rule NSDeleteRuleDeny is non-empty.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationNumberTooLargeError

Error code to denote some numerical value is too large.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationNumberTooSmallError

Error code to denote some numerical value is too small.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationDateTooLateError

Error code to denote some date value is too late.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationDateTooSoonError

Error code to denote some date value is too soon.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationInvalidDateError

Error code to denote some date value fails to match date pattern.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationStringTooLongError

Error code to denote some string value is too long.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationStringTooShortError

Error code to denote some string value is too short.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSValidationStringPatternMatchingError

Error code to denote some string value fails to match some pattern.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

Discussion

For additional error codes, including NSValidationErrorMinimum and NSValidationErrorMaximum, see NSError.

Object Graph Management Error Codes

These error codes specify Core Data errors related to object graph management.

NSManagedObjectContextLockingError               = 132000,
NSPersistentStoreCoordinatorLockingError         = 132010,
NSManagedObjectReferentialIntegrityError         = 133000,
NSManagedObjectExternalRelationshipError         = 133010,
NSManagedObjectMergeError                        = 133020,
Constants
NSManagedObjectContextLockingError

Error code to denote an inability to acquire a lock in a managed object context.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreCoordinatorLockingError

Error code to denote an inability to acquire a lock in a persistent store.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSManagedObjectReferentialIntegrityError

Error code to denote an attempt to fire a fault pointing to an object that does not exist.

The store is accessible, but the object corresponding to the fault cannot be found.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSManagedObjectExternalRelationshipError

Error code to denote that an object being saved has a relationship containing an object from another store.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSManagedObjectMergeError

Error code to denote that a merge policy failed—Core Data is unable to complete merging.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

Persistent Store Error Codes

Error codes related to persistent stores.

NSPersistentStoreInvalidTypeError                = 134000,
NSPersistentStoreTypeMismatchError               = 134010,
NSPersistentStoreIncompatibleSchemaError         = 134020,
NSPersistentStoreSaveError                       = 134030,
NSPersistentStoreIncompleteSaveError             = 134040,
NSPersistentStoreSaveConflictsError              = 134050,
NSPersistentStoreOperationError                  = 134070,
NSPersistentStoreOpenError                       = 134080,
NSPersistentStoreTimeoutError                    = 134090,
NSPersistentStoreIncompatibleVersionHashError    = 134100,
Constants
NSPersistentStoreInvalidTypeError

Error code to denote an unknown persistent store type/format/version.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreTypeMismatchError

Error code returned by a persistent store coordinator if a store is accessed that does not match the specified type.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreIncompatibleSchemaError

Error code to denote that a persistent store returned an error for a save operation.

This code pertains to database level errors such as a missing table.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreSaveError

Error code to denote that a persistent store returned an error for a save operation.

This code pertains to errors such as permissions problems.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreIncompleteSaveError

Error code to denote that one or more of the stores returned an error during a save operations.

The stores or objects that failed are in the corresponding user info dictionary of the NSError object.

Available in OS X v10.4 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreSaveConflictsError

Error code to denote that an unresolved merge conflict was encountered during a save. .

The NSError object’s user info dictionary contains the key NSPersistentStoreSaveConflictsErrorKey.

Available in OS X v10.7 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreOperationError

Error code to denote that a persistent store operation failed.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreOpenError

Error code to denote an error occurred while attempting to open a persistent store.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreTimeoutError

Error code to denote that Core Data failed to connect to a persistent store within the time specified by NSPersistentStoreTimeoutOption.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreUnsupportedRequestTypeError

Error code to denote that an NSPersistentStore subclass was passed a request (an instance of NSPersistentStoreRequest) that it did not understand.

Available in OS X v10.7 and later.

Declared in CoreDataErrors.h.

NSPersistentStoreIncompatibleVersionHashError

Error code to denote that entity version hashes in the store are incompatible with the current managed object model.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

Migration Error Codes

Error codes related to store migration.

NSMigrationError                                 = 134110,
NSMigrationCancelledError                        = 134120,
NSMigrationMissingSourceModelError               = 134130,
NSMigrationMissingMappingModelError              = 134140,
NSMigrationManagerSourceStoreError               = 134150,
NSMigrationManagerDestinationStoreError          = 134160,
NSEntityMigrationPolicyError                     = 134170,
NSInferredMappingModelError                      = 134190,
NSExternalRecordImportError                      = 134200,
Constants
NSMigrationError

Error code to denote a general migration error.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSMigrationCancelledError

Error code to denote that migration failed due to manual cancellation.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSMigrationMissingSourceModelError

Error code to denote that migration failed due to a missing source data model.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSMigrationMissingMappingModelError

Error code to denote that migration failed due to a missing mapping model.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSMigrationManagerSourceStoreError

Error code to denote that migration failed due to a problem with the source data store.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSMigrationManagerDestinationStoreError

Error code to denote that migration failed due to a problem with the destination data store.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSEntityMigrationPolicyError

Error code to denote that migration failed during processing of an entity migration policy.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSInferredMappingModelError

Error code to denote a problem with the creation of an inferred mapping model.

Available in OS X v10.6 and later.

Declared in CoreDataErrors.h.

NSExternalRecordImportError

Error code to denote a general error encountered while importing external records.

Available in OS X v10.6 and later.

Declared in CoreDataErrors.h.

General Error Codes

Error codes that denote a general error.

NSCoreDataError                                  = 134060,
NSSQLiteError                                    = 134180,
Constants
NSCoreDataError

Error code to denote a general Core Data error.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

NSSQLiteError

Error code to denote a general SQLite error.

Available in OS X v10.5 and later.

Declared in CoreDataErrors.h.

Core Data Version Number

Specifies the current Core Data version number.

double NSCoreDataVersionNumber;
Constants
NSCoreDataVersionNumber

Specifies the version of Core Data available in the current process.

Available in OS X v10.4 and later.

Declared in CoreDataDefines.h.

Discussion

See “Core Data Version Numbers” for defined versions.

Core Data Version Numbers

Specify Core Data version numbers.

#define NSCoreDataVersionNumber10_4               46.0
#define NSCoreDataVersionNumber10_4_3             77.0
#define NSCoreDataVersionNumber10_5              185.0
#define NSCoreDataVersionNumber10_5_3            186.0
#define NSCoreDataVersionNumber10_6              246.0
#define NSCoreDataVersionNumber10_6_2            250.0
#define NSCoreDataVersionNumber10_6_3            251.0
#define NSCoreDataVersionNumber10_7              358.4
#define NSCoreDataVersionNumber10_7_2            358.12
#define NSCoreDataVersionNumber10_7_3            358.13
#define NSCoreDataVersionNumber10_7_4            358.14
#define NSCoreDataVersionNumber10_8              407.5
#define NSCoreDataVersionNumber10_8_2            407.7
#define NSCoreDataVersionNumber_iPhoneOS_3_0     241.0
#define NSCoreDataVersionNumber_iPhoneOS_3_1     248.0
#define NSCoreDataVersionNumber_iPhoneOS_3_2     310.2
#define NSCoreDataVersionNumber_iPhoneOS_4_0     320.5
#define NSCoreDataVersionNumber_iPhoneOS_4_1     320.11
#define NSCoreDataVersionNumber_iPhoneOS_4_2     320.15
#define NSCoreDataVersionNumber_iPhoneOS_4_3     320.17
#define NSCoreDataVersionNumber_iPhoneOS_5_0     386.1
#define NSCoreDataVersionNumber_iPhoneOS_5_1     386.5
#define NSCoreDataVersionNumber_iPhoneOS_6_0     419.0
Constants
NSCoreDataVersionNumber10_4

Specifies the Core Data version number released with OS X v10.4.

Available in OS X v10.5 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_4_3

Specifies the Core Data version number released with OS X v10.4.3.

Available in OS X v10.5 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_5

Specifies the Core Data version number released with OS X v10.5.

Available in OS X v10.6 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_5_3

Specifies the Core Data version number released with OS X v10.5.3.

Available in OS X v10.6 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_6

Specifies the Core Data version number released with OS X v10.6.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_6_2

Specifies the Core Data version number released with OS X v10.6.2.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_6_3

Specifies the Core Data version number released with OS X v10.6.3.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_7

Specifies the Core Data version number released with OS X v10.7.

Available in OS X v10.8 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_7_2

Specifies the Core Data version number released with OS X v10.7.2.

Available in OS X v10.8 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_7_3

Specifies the Core Data version number released with OS X v10.7.3.

Available in OS X v10.8 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_7_4

Specifies the Core Data version number released with OS X v10.7.4.

Available in OS X v10.9 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_8

Specifies the Core Data version number released with OS X v10.8.

Available in OS X v10.9 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber10_8_2

Specifies the Core Data version number released with OS X v10.8.2.

Available in OS X v10.9 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_3_0

Specifies the Core Data version number released with iOS 3.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_3_1

Specifies the Core Data version number released with iOS 3.1.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_3_2

Specifies the Core Data version number released with iOS 3.2.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_4_0

Specifies the Core Data version number released with iOS 4.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_4_1

Specifies the Core Data version number released with iOS 4.1.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_4_2

Specifies the Core Data version number released with iOS 4.2.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_4_3

Specifies the Core Data version number released with iOS 4.2.

Available in OS X v10.7 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_5_0

Specifies the Core Data version number released with iOS 5.

Available in OS X v10.8 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_5_1

Specifies the Core Data version number released with iOS 5.1.

Available in OS X v10.8 and later.

Declared in CoreDataDefines.h.

NSCoreDataVersionNumber_iPhoneOS_6_0

Specifies the Core Data version number released with iOS 6.

Available in OS X v10.9 and later.

Declared in CoreDataDefines.h.

Discussion

See “Core Data Version Number” for the current version.