Enumeration

NSError Codes

Error codes in the Cocoa error domain.

Declaration

enum : NSInteger {
    ...
};

Overview

The constants in this enumeration are NSError code numbers in the Cocoa error domain (NSCocoaErrorDomain). Other frameworks, most notably the Application Kit, provide their own NSCocoaErrorDomain error codes.

The enumeration constants beginning with NSFile indicate file-system errors or errors related to file I/O operations. Use the key NSFilePathErrorKey or the NSURLErrorKey (whichever is appropriate) to access the file-system path or URL in the userInfo dictionary of the NSError object.

Topics

Bundle Errors

NSBundleErrorMinimum

The start of the range of error codes reserved for bundle errors.

NSBundleErrorMaximum

The end of the range of error codes reserved for bundle errors.

NSBundleOnDemandResourceExceededMaximumSizeError

The application exceeded the amount of on-demand resources content in use at one time.

NSBundleOnDemandResourceInvalidTagError

The application specified a tag that the system couldn’t find in the application tag manifest.

NSBundleOnDemandResourceOutOfSpaceError

Insufficient space available to download the requested on-demand resources.

Cancellation

NSUserCancelledError

The user canceled the operation (for example, by pressing Command-period).

Cloud-Sharing Errors

NSCloudSharingErrorMinimum

The start of the range of error codes reserved for cloud-sharing errors.

NSCloudSharingErrorMaximum

The end of the range of error codes reserved for cloud-sharing errors.

NSCloudSharingConflictError

A conflict occurred during an attempt to save changes.

NSCloudSharingNetworkFailureError

Sharing failed due to a network failure.

NSCloudSharingNoPermissionError

The current user doesn’t have permission to perform the requested actions.

NSCloudSharingOtherError

An otherwise unspecified cloud-sharing error occurred.

NSCloudSharingQuotaExceededError

The user doesn’t have enough storage space available to share the requested items.

NSCloudSharingTooManyParticipantsError

Additional participants couldn’t be added to the share, because the limit was reached.

Coder Errors

NSCoderErrorMinimum

The start of the range of error codes reserved for coder errors.

NSCoderErrorMaximum

The end of the range of error codes reserved for coder errors.

NSCoderValueNotFoundError

The requested data wasn’t found.

NSCoderReadCorruptError

Decoding failed due to corrupt data.

NSCoderInvalidValueError

Data wasn’t valid to encode.

Executable Errors

NSExecutableErrorMinimum

The beginning of the range of error codes reserved for errors related to executable files.

NSExecutableErrorMaximum

The end of the range of error codes reserved for errors related to executable files.

NSExecutableArchitectureMismatchError

The executable doesn’t provide an architecture compatible with the current process.

NSExecutableLinkError

The executable failed due to linking issues.

NSExecutableLoadError

Executable cannot be loaded for an otherwise-unspecified reason.

NSExecutableNotLoadableError

The executable type isn’t loadable in the current process.

NSExecutableRuntimeMismatchError

The executable has Objective-C runtime information that’s incompatible with the current process.

Formatting Errors

NSFormattingErrorMinimum

The start of the range of error codes reserved for formatting errors.

NSFormattingErrorMaximum

The end of the range of error codes reserved for formatting errors.

NSFormattingError

A formatter couldn’t generate a string for an object, or parse a string into an object.

File Errors

NSFileErrorMinimum

The start of the range of error codes reserved for file errors.

NSFileErrorMaximum

The end of the range of error codes reserved for file errors.

NSFileLockingError

The file could not be locked.

NSFileManagerUnmountBusyError

The volume couldn’t be unmounted because it’s in use.

NSFileManagerUnmountUnknownError

The volume couldn't be unmounted, for unknown reasons.

NSFileNoSuchFileError

A filesystem operation was attempted on a non-existent file.

File Reading Errors

NSFileReadCorruptFileError

Could not read because of a corrupted file, bad format, or similar reason.

NSFileReadInapplicableStringEncodingError

Could not read because the string encoding wasn’t applicable.

NSFileReadInvalidFileNameError

Could not read because of an invalid file name.

NSFileReadNoPermissionError

Could not read because of a permission problem.

NSFileReadNoSuchFileError

Could not read because no such file was found.

NSFileReadTooLargeError

Could not read because the specified file was too large.

NSFileReadUnknownError

Could not read, for unknown reasons.

NSFileReadUnknownStringEncodingError

Could not read because the string coding of the file couldn’t be determined.

NSFileReadUnsupportedSchemeError

Could not read because the specified URL scheme is unsupported.

File Writing Errors

NSFileWriteFileExistsError

Could not perform an operation because the destination file already exists.

NSFileWriteInapplicableStringEncodingError

Could not write because the string encoding was not applicable.

NSFileWriteInvalidFileNameError

Could not write because of an invalid file name.

NSFileWriteNoPermissionError

Could not write because of a permission problem.

NSFileWriteOutOfSpaceError

Could not write because of a lack of disk space.

NSFileWriteUnknownError

Could not write, for unknown reasons.

NSFileWriteUnsupportedSchemeError

Could not write because the specified URL scheme is unsupported.

NSFileWriteVolumeReadOnlyError

Could not write because the volume is read-only.

iCloud File Errors

NSUbiquitousFileErrorMinimum

The minimum error code value that represents an iCloud error.

NSUbiquitousFileErrorMaximum

The maximum error code value that represents an iCloud error.

NSUbiquitousFileNotUploadedDueToQuotaError

The item could not be uploaded to iCloud because it would make the account go over its quota.

NSUbiquitousFileUbiquityServerNotAvailable

A failure to connect to the iCloud servers.

NSUbiquitousFileUnavailableError

The item has not been uploaded to iCloud by another device yet.

Property List Errors

NSPropertyListErrorMinimum

The start of the range of error codes reserved for property list errors.

NSPropertyListErrorMaximum

The end of the range of error codes reserved for property list errors.

NSPropertyListReadCorruptError

Parsing of the property list failed.

NSPropertyListReadStreamError

Reading of the property list failed.

NSPropertyListReadUnknownVersionError

The version number of the property list cannot be determined.

NSPropertyListWriteInvalidError

Writing failed because of an invalid property list object, or an invalid property list type was specified.

NSPropertyListWriteStreamError

Writing to the property list failed.

User Activity Errors

NSUserActivityErrorMinimum

The start of the range of error codes reserved for user activity errors.

NSUserActivityErrorMaximum

The end of the range of error codes reserved for user activity errors.

NSUserActivityConnectionUnavailableError

The user activity couldn’t be continued because a required connection was not available.

NSUserActivityHandoffFailedError

The data for the user activity was not available.

NSUserActivityHandoffUserInfoTooLargeError

The user info dictionary was too large to receive.

NSUserActivityRemoteApplicationTimedOutError

The remote application failed to send data within the specified time.

Validation Errors

NSValidationErrorMinimum

The start of the range of error codes reserved for validation errors.

NSValidationErrorMaximum

The end of the range of error codes reserved for validation errors.

XPC Errors

NSXPCConnectionErrorMinimum

The lower bounds of XPC connection error code values.

NSXPCConnectionErrorMaximum

The upper bounds of XPC connection error code values.

NSXPCConnectionInterrupted

The XPC connection was interrupted.

NSXPCConnectionInvalid

The XPC connection was invalid.

NSXPCConnectionReplyInvalid

The XPC connection reply was invalid.

URL Errors

NSURLErrorAppTransportSecurityRequiresSecureConnection

App Transport Security disallowed a connection because there is no secure network connection.

NSURLErrorBackgroundSessionInUseByAnotherProcess

An app or app extension attempted to connect to a background session that is already connected to a process.

NSURLErrorBackgroundSessionRequiresSharedContainer

The shared container identifier of the URL session configuration is needed but hasn’t been set.

NSURLErrorBackgroundSessionWasDisconnected

The app is suspended or exits while a background data task is processing.

NSURLErrorBadServerResponse

The URL Loading System received bad data from the server.

NSURLErrorBadURL

A malformed URL prevented a URL request from being initiated.

NSURLErrorCallIsActive

A connection was attempted while a phone call was active on a network that doesn’t support simultaneous phone and data communication, such as EDGE or GPRS.

NSURLErrorCancelled

An asynchronous load has been canceled.

NSURLErrorCannotCloseFile

A download task couldn’t close the downloaded file on disk.

NSURLErrorCannotConnectToHost

An attempt to connect to a host failed.

NSURLErrorCannotCreateFile

A download task couldn’t create the downloaded file on disk because of an I/O failure.

NSURLErrorCannotDecodeContentData

Content data received during a connection request had an unknown content encoding.

NSURLErrorCannotDecodeRawData

Content data received during a connection request couldn’t be decoded for a known content encoding.

NSURLErrorCannotFindHost

The host name for a URL couldn’t be resolved.

NSURLErrorCannotLoadFromNetwork

A specific request to load an item only from the cache couldn't be satisfied.

NSURLErrorCannotMoveFile

A downloaded file on disk couldn’t be moved.

NSURLErrorCannotOpenFile

A downloaded file on disk couldn’t be opened.

NSURLErrorCannotParseResponse

A response to a connection request couldn’t be parsed.

NSURLErrorCannotRemoveFile

A downloaded file couldn’t be removed from disk.

NSURLErrorCannotWriteToFile

A download task couldn’t write the file to disk.

NSURLErrorClientCertificateRejected

A server certificate was rejected.

NSURLErrorClientCertificateRequired

A client certificate was required to authenticate an SSL connection during a connection request.

NSURLErrorDNSLookupFailed

The host address couldn’t be found via DNS lookup.

NSURLErrorDataLengthExceedsMaximum

The length of the resource data exceeded the maximum allowed.

NSURLErrorDataNotAllowed

The cellular network disallowed a connection.

NSURLErrorDownloadDecodingFailedMidStream

A download task failed to decode an encoded file during the download.

NSURLErrorDownloadDecodingFailedToComplete

A download task failed to decode an encoded file after downloading.

NSURLErrorFileDoesNotExist

The specified file doesn’t exist.

NSURLErrorFileIsDirectory

A request for an FTP file resulted in the server responding that the file is not a plain file, but a directory.

NSURLErrorFileOutsideSafeArea

An internal file operation failed.

NSURLErrorHTTPTooManyRedirects

A redirect loop was detected or the threshold for number of allowable redirects was exceeded (currently 16).

NSURLErrorInternationalRoamingOff

The attempted connection required activating a data context while roaming, but international roaming is disabled.

NSURLErrorNetworkConnectionLost

A client or server connection was severed in the middle of an in-progress load.

NSURLErrorNoPermissionsToReadFile

A resource couldn’t be read because of insufficient permissions.

NSURLErrorNotConnectedToInternet

A network resource was requested, but an internet connection has not been established and can’t be established automatically.

NSURLErrorRedirectToNonExistentLocation

A redirect was specified by way of server response code, but the server didn’t accompany this code with a redirect URL.

NSURLErrorRequestBodyStreamExhausted

A body stream was needed but the client did not provide one.

NSURLErrorResourceUnavailable

A requested resource couldn’t be retrieved.

NSURLErrorSecureConnectionFailed

An attempt to establish a secure connection failed for reasons that can’t be expressed more specifically.

NSURLErrorServerCertificateHasBadDate

A server certificate is expired, or is not yet valid.

NSURLErrorServerCertificateHasUnknownRoot

A server certificate wasn’t signed by any root server.

NSURLErrorServerCertificateNotYetValid

A server certificate isn’t valid yet.

NSURLErrorServerCertificateUntrusted

A server certificate was signed by a root server that isn’t trusted.

NSURLErrorTimedOut

An asynchronous operation timed out.

NSURLErrorUnknown

The URL Loading System encountered an error that it can’t interpret.

NSURLErrorUnsupportedURL

A properly formed URL couldn’t be handled by the framework.

NSURLErrorUserAuthenticationRequired

Authentication was required to access a resource.

NSURLErrorUserCancelledAuthentication

An asynchronous request for authentication has been canceled by the user.

NSURLErrorZeroByteResource

A server reported that a URL has a non-zero content length, but terminated the network connection gracefully without sending any data.

Miscellaneous Errors

NSFeatureUnsupportedError

The feature isn’t supported, because the file system lacks the feature, or required libraries are missing, or other similar reasons.

NSKeyValueValidationError

A key-value coding validation error.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software