iOS Developer Library

Developer

CoreData Framework Reference Core Data Constants Reference

Options
Deployment Target:

On This Page
Language:

Core Data Constants Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreData

Objective-C

@import CoreData;

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

Constants

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

    Declaration

    Swift

    let NSDetailedErrorsKey: String let NSValidationObjectErrorKey: String let NSValidationKeyErrorKey: String let NSValidationPredicateErrorKey: String let NSValidationValueErrorKey: String let NSAffectedStoresErrorKey: String let NSAffectedObjectsErrorKey: String let NSPersistentStoreSaveConflictsErrorKey: String

    Objective-C

    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

      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 iOS 3.0 and later.

    • NSValidationObjectErrorKey

      NSValidationObjectErrorKey

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

      Available in iOS 3.0 and later.

    • NSValidationKeyErrorKey

      NSValidationKeyErrorKey

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

      Available in iOS 3.0 and later.

    • NSValidationPredicateErrorKey

      NSValidationPredicateErrorKey

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

      Available in iOS 3.0 and later.

    • NSValidationValueErrorKey

      NSValidationValueErrorKey

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

      Available in iOS 3.0 and later.

    • NSAffectedStoresErrorKey

      NSAffectedStoresErrorKey

      The key for stores prompting an error.

      Available in iOS 3.0 and later.

    • NSAffectedObjectsErrorKey

      NSAffectedObjectsErrorKey

      The key for objects prompting an error.

      Available in iOS 3.0 and later.

    • NSPersistentStoreSaveConflictsErrorKey

      NSPersistentStoreSaveConflictsErrorKey

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

      Available in iOS 5.0 and later.

  • Constant to identify the SQLite error domain.

    Declaration

    Swift

    let NSSQLiteErrorDomain: String

    Objective-C

    const NSString *NSSQLiteErrorDomain;

    Constants

    • NSSQLiteErrorDomain

      NSSQLiteErrorDomain

      Domain for SQLite errors.

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

      Available in iOS 3.0 and later.

  • Error codes related to validation.

    Declaration

    Swift

    var NSManagedObjectValidationError: Int { get } var NSValidationMultipleErrorsError: Int { get } var NSValidationMissingMandatoryPropertyError: Int { get } var NSValidationRelationshipLacksMinimumCountError: Int { get } var NSValidationRelationshipExceedsMaximumCountError: Int { get } var NSValidationRelationshipDeniedDeleteError: Int { get } var NSValidationNumberTooLargeError: Int { get } var NSValidationNumberTooSmallError: Int { get } var NSValidationDateTooLateError: Int { get } var NSValidationDateTooSoonError: Int { get } var NSValidationInvalidDateError: Int { get } var NSValidationStringTooLongError: Int { get } var NSValidationStringTooShortError: Int { get } var NSValidationStringPatternMatchingError: Int { get }

    Objective-C

    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

      NSManagedObjectValidationError

      Error code to denote a generic validation error.

      Available in iOS 3.0 and later.

    • NSValidationMultipleErrorsError

      NSValidationMultipleErrorsError

      Error code to denote an error containing multiple validation errors.

      Available in iOS 3.0 and later.

    • NSValidationMissingMandatoryPropertyError

      NSValidationMissingMandatoryPropertyError

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

      Available in iOS 3.0 and later.

    • NSValidationRelationshipLacksMinimumCountError

      NSValidationRelationshipLacksMinimumCountError

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

      Available in iOS 3.0 and later.

    • NSValidationRelationshipExceedsMaximumCountError

      NSValidationRelationshipExceedsMaximumCountError

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

      Available in iOS 3.0 and later.

    • NSValidationRelationshipDeniedDeleteError

      NSValidationRelationshipDeniedDeleteError

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

      Available in iOS 3.0 and later.

    • NSValidationNumberTooLargeError

      NSValidationNumberTooLargeError

      Error code to denote some numerical value is too large.

      Available in iOS 3.0 and later.

    • NSValidationNumberTooSmallError

      NSValidationNumberTooSmallError

      Error code to denote some numerical value is too small.

      Available in iOS 3.0 and later.

    • NSValidationDateTooLateError

      NSValidationDateTooLateError

      Error code to denote some date value is too late.

      Available in iOS 3.0 and later.

    • NSValidationDateTooSoonError

      NSValidationDateTooSoonError

      Error code to denote some date value is too soon.

      Available in iOS 3.0 and later.

    • NSValidationInvalidDateError

      NSValidationInvalidDateError

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

      Available in iOS 3.0 and later.

    • NSValidationStringTooLongError

      NSValidationStringTooLongError

      Error code to denote some string value is too long.

      Available in iOS 3.0 and later.

    • NSValidationStringTooShortError

      NSValidationStringTooShortError

      Error code to denote some string value is too short.

      Available in iOS 3.0 and later.

    • NSValidationStringPatternMatchingError

      NSValidationStringPatternMatchingError

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

      Available in iOS 3.0 and later.

    Discussion

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

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

    Declaration

    Swift

    var NSManagedObjectContextLockingError: Int { get } var NSPersistentStoreCoordinatorLockingError: Int { get } var NSManagedObjectReferentialIntegrityError: Int { get } var NSManagedObjectExternalRelationshipError: Int { get } var NSManagedObjectMergeError: Int { get }

    Objective-C

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

    Constants

    • NSManagedObjectContextLockingError

      NSManagedObjectContextLockingError

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

      Available in iOS 3.0 and later.

    • NSPersistentStoreCoordinatorLockingError

      NSPersistentStoreCoordinatorLockingError

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

      Available in iOS 3.0 and later.

    • NSManagedObjectReferentialIntegrityError

      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 iOS 3.0 and later.

    • NSManagedObjectExternalRelationshipError

      NSManagedObjectExternalRelationshipError

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

      Available in iOS 3.0 and later.

    • NSManagedObjectMergeError

      NSManagedObjectMergeError

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

      Available in iOS 3.0 and later.

  • Error codes related to persistent stores.

    Declaration

    Swift

    var NSPersistentStoreInvalidTypeError: Int { get } var NSPersistentStoreTypeMismatchError: Int { get } var NSPersistentStoreIncompatibleSchemaError: Int { get } var NSPersistentStoreSaveError: Int { get } var NSPersistentStoreIncompleteSaveError: Int { get } var NSPersistentStoreSaveConflictsError: Int { get } var NSPersistentStoreOperationError: Int { get } var NSPersistentStoreOpenError: Int { get } var NSPersistentStoreTimeoutError: Int { get } var NSPersistentStoreUnsupportedRequestTypeError: Int { get } var NSPersistentStoreIncompatibleVersionHashError: Int { get }

    Objective-C

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

    Constants

    • NSPersistentStoreInvalidTypeError

      NSPersistentStoreInvalidTypeError

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

      Available in iOS 3.0 and later.

    • NSPersistentStoreTypeMismatchError

      NSPersistentStoreTypeMismatchError

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

      Available in iOS 3.0 and later.

    • NSPersistentStoreIncompatibleSchemaError

      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 iOS 3.0 and later.

    • NSPersistentStoreSaveError

      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 iOS 3.0 and later.

    • NSPersistentStoreIncompleteSaveError

      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 iOS 3.0 and later.

    • NSPersistentStoreSaveConflictsError

      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 iOS 5.0 and later.

    • NSPersistentStoreOperationError

      NSPersistentStoreOperationError

      Error code to denote that a persistent store operation failed.

      Available in iOS 3.0 and later.

    • NSPersistentStoreOpenError

      NSPersistentStoreOpenError

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

      Available in iOS 3.0 and later.

    • NSPersistentStoreTimeoutError

      NSPersistentStoreTimeoutError

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

      Available in iOS 3.0 and later.

    • NSPersistentStoreUnsupportedRequestTypeError

      NSPersistentStoreUnsupportedRequestTypeError

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

      Available in iOS 5.0 and later.

    • NSPersistentStoreIncompatibleVersionHashError

      NSPersistentStoreIncompatibleVersionHashError

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

      Available in iOS 3.0 and later.

  • Error codes related to store migration.

    Declaration

    Swift

    var NSMigrationError: Int { get } var NSMigrationCancelledError: Int { get } var NSMigrationMissingSourceModelError: Int { get } var NSMigrationMissingMappingModelError: Int { get } var NSMigrationManagerSourceStoreError: Int { get } var NSMigrationManagerDestinationStoreError: Int { get } var NSEntityMigrationPolicyError: Int { get } var NSInferredMappingModelError: Int { get } var NSExternalRecordImportError: Int { get }

    Objective-C

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

    Constants

    • NSMigrationError

      NSMigrationError

      Error code to denote a general migration error.

      Available in iOS 3.0 and later.

    • NSMigrationCancelledError

      NSMigrationCancelledError

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

      Available in iOS 3.0 and later.

    • NSMigrationMissingSourceModelError

      NSMigrationMissingSourceModelError

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

      Available in iOS 3.0 and later.

    • NSMigrationMissingMappingModelError

      NSMigrationMissingMappingModelError

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

      Available in iOS 3.0 and later.

    • NSMigrationManagerSourceStoreError

      NSMigrationManagerSourceStoreError

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

      Available in iOS 3.0 and later.

    • NSMigrationManagerDestinationStoreError

      NSMigrationManagerDestinationStoreError

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

      Available in iOS 3.0 and later.

    • NSEntityMigrationPolicyError

      NSEntityMigrationPolicyError

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

      Available in iOS 3.0 and later.

    • NSInferredMappingModelError

      NSInferredMappingModelError

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

      Available in iOS 3.0 and later.

    • NSExternalRecordImportError

      NSExternalRecordImportError

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

      Available in iOS 3.0 and later.

  • Error codes that denote a general error.

    Declaration

    Swift

    var NSCoreDataError: Int { get } var NSSQLiteError: Int { get }

    Objective-C

    NSCoreDataError = 134060, NSSQLiteError = 134180,

    Constants

    • NSCoreDataError

      NSCoreDataError

      Error code to denote a general Core Data error.

      Available in iOS 3.0 and later.

    • NSSQLiteError

      NSSQLiteError

      Error code to denote a general SQLite error.

      Available in iOS 3.0 and later.

  • Specifies the current Core Data version number.

    Declaration

    Swift

    var NSCoreDataVersionNumber: Double

    Objective-C

    double NSCoreDataVersionNumber;

    Constants

    • NSCoreDataVersionNumber

      NSCoreDataVersionNumber

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

      Available in iOS 3.0 and later.

    Discussion

    See “Core Data Version Numbers” for defined versions.

  • Specify Core Data version numbers.

    Declaration

    Swift

    var NSCoreDataVersionNumber10_4: Double { get } var NSCoreDataVersionNumber10_4_3: Double { get } var NSCoreDataVersionNumber10_5: Double { get } var NSCoreDataVersionNumber10_5_3: Double { get } var NSCoreDataVersionNumber10_6: Double { get } var NSCoreDataVersionNumber10_6_2: Double { get } var NSCoreDataVersionNumber10_6_3: Double { get } var NSCoreDataVersionNumber10_7: Double { get } var NSCoreDataVersionNumber10_7_2: Double { get } var NSCoreDataVersionNumber10_7_3: Double { get } var NSCoreDataVersionNumber10_7_4: Double { get } var NSCoreDataVersionNumber10_8: Double { get } var NSCoreDataVersionNumber10_8_2: Double { get } var NSCoreDataVersionNumber_iPhoneOS_3_0: Double { get } var NSCoreDataVersionNumber_iPhoneOS_3_1: Double { get } var NSCoreDataVersionNumber_iPhoneOS_3_2: Double { get } var NSCoreDataVersionNumber_iPhoneOS_4_0: Double { get } var NSCoreDataVersionNumber_iPhoneOS_4_1: Double { get } var NSCoreDataVersionNumber_iPhoneOS_4_2: Double { get } var NSCoreDataVersionNumber_iPhoneOS_4_3: Double { get } var NSCoreDataVersionNumber_iPhoneOS_5_0: Double { get } var NSCoreDataVersionNumber_iPhoneOS_5_1: Double { get } var NSCoreDataVersionNumber_iPhoneOS_6_0: Double { get }

    Objective-C

    #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

      NSCoreDataVersionNumber10_4

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

      Available in iOS 3.0 and later.

    • NSCoreDataVersionNumber10_4_3

      NSCoreDataVersionNumber10_4_3

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

      Available in iOS 3.0 and later.

    • NSCoreDataVersionNumber10_5

      NSCoreDataVersionNumber10_5

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

      Available in iOS 3.0 and later.

    • NSCoreDataVersionNumber10_5_3

      NSCoreDataVersionNumber10_5_3

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

      Available in iOS 3.0 and later.

    • NSCoreDataVersionNumber10_6

      NSCoreDataVersionNumber10_6

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

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber10_6_2

      NSCoreDataVersionNumber10_6_2

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

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber10_6_3

      NSCoreDataVersionNumber10_6_3

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

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber10_7

      NSCoreDataVersionNumber10_7

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

      Available in iOS 6.0 and later.

    • NSCoreDataVersionNumber10_7_2

      NSCoreDataVersionNumber10_7_2

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

      Available in iOS 6.0 and later.

    • NSCoreDataVersionNumber10_7_3

      NSCoreDataVersionNumber10_7_3

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

      Available in iOS 6.0 and later.

    • NSCoreDataVersionNumber10_7_4

      NSCoreDataVersionNumber10_7_4

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

      Available in iOS 7.0 and later.

    • NSCoreDataVersionNumber10_8

      NSCoreDataVersionNumber10_8

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

      Available in iOS 7.0 and later.

    • NSCoreDataVersionNumber10_8_2

      NSCoreDataVersionNumber10_8_2

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

      Available in iOS 7.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_3_0

      NSCoreDataVersionNumber_iPhoneOS_3_0

      Specifies the Core Data version number released with iOS 3.

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_3_1

      NSCoreDataVersionNumber_iPhoneOS_3_1

      Specifies the Core Data version number released with iOS 3.1.

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_3_2

      NSCoreDataVersionNumber_iPhoneOS_3_2

      Specifies the Core Data version number released with iOS 3.2.

      Available in iOS 4.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_4_0

      NSCoreDataVersionNumber_iPhoneOS_4_0

      Specifies the Core Data version number released with iOS 4.

      Available in iOS 4.1 and later.

    • NSCoreDataVersionNumber_iPhoneOS_4_1

      NSCoreDataVersionNumber_iPhoneOS_4_1

      Specifies the Core Data version number released with iOS 4.1.

      Available in iOS 5.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_4_2

      NSCoreDataVersionNumber_iPhoneOS_4_2

      Specifies the Core Data version number released with iOS 4.2.

      Available in iOS 5.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_4_3

      NSCoreDataVersionNumber_iPhoneOS_4_3

      Specifies the Core Data version number released with iOS 4.2.

      Available in iOS 5.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_5_0

      NSCoreDataVersionNumber_iPhoneOS_5_0

      Specifies the Core Data version number released with iOS 5.

      Available in iOS 6.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_5_1

      NSCoreDataVersionNumber_iPhoneOS_5_1

      Specifies the Core Data version number released with iOS 5.1.

      Available in iOS 6.0 and later.

    • NSCoreDataVersionNumber_iPhoneOS_6_0

      NSCoreDataVersionNumber_iPhoneOS_6_0

      Specifies the Core Data version number released with iOS 6.

      Available in iOS 7.0 and later.

    Discussion

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