NSError Codes
NSError
codes in the Cocoa error domain.
enum { NSFileNoSuchFileError = 4, NSFileLockingError = 255, NSFileReadUnknownError = 256, NSFileReadNoPermissionError = 257, NSFileReadInvalidFileNameError = 258, NSFileReadCorruptFileError = 259, NSFileReadNoSuchFileError = 260, NSFileReadInapplicableStringEncodingError = 261, NSFileReadUnsupportedSchemeError = 262, NSFileReadTooLargeError = 263, NSFileReadUnknownStringEncodingError = 264, NSFileWriteUnknownError = 512, NSFileWriteNoPermissionError = 513, NSFileWriteInvalidFileNameError = 514, NSFileWriteFileExistsError = 516, NSFileWriteInapplicableStringEncodingError = 517, NSFileWriteUnsupportedSchemeError = 518, NSFileWriteOutOfSpaceError = 640, NSFileWriteVolumeReadOnlyError = 642, NSKeyValueValidationError = 1024, NSFormattingError = 2048, NSUserCancelledError = 3072, NSFileErrorMinimum = 0, NSFileErrorMaximum = 1023, NSValidationErrorMinimum = 1024, NSValidationErrorMaximum = 2047, NSFormattingErrorMinimum = 2048, NSFormattingErrorMaximum = 2559, NSPropertyListReadCorruptError = 3840, NSPropertyListReadUnknownVersionError = 3841, NSPropertyListReadStreamError = 3842, NSPropertyListWriteStreamError = 3851, NSPropertyListErrorMinimum = 3840, NSPropertyListErrorMaximum = 4095 NSExecutableErrorMinimum = 3584, NSExecutableNotLoadableError = 3584, NSExecutableArchitectureMismatchError = 3585, NSExecutableRuntimeMismatchError = 3586, NSExecutableLoadError = 3587, NSExecutableLinkError = 3588, NSExecutableErrorMaximum = 3839, }
Constants
-
File-system operation attempted on non-existent file
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Failure to get a lock on file
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error, reason unknown
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because of a permission problem
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because of an invalid file name
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because of a corrupted file, bad format, or similar reason
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because no such file was found
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because the string encoding was not applicable.
Access the bad encoding from the
userInfo
dictionary using theNSStringEncodingErrorKey
key.Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because the specified URL scheme is unsupported
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Read error because the specified file was too large.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Read error because the string coding of the file could not be determined
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Write error, reason unknown
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error because of a permission problem
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error because of an invalid file name
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error returned when NSFileManager class’s copy, move, and link methods report errors when the destination file already exists.
Available in OS X v10.7 and later.
Declared in
FoundationErrors.h
. -
Write error because the string encoding was not applicable.
Access the bad encoding from the
userInfo
dictionary using theNSStringEncodingErrorKey
key.Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error because the specified URL scheme is unsupported
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error because of a lack of disk space
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Write error because because the volume is read only.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
Key-value coding validation error
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Formatting error (related to display of data)
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
The user cancelled the operation (for example, by pressing Command-period).
This code is for errors that do not require a dialog displayed and might be candidates for special-casing.
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks the start of the range of error codes reserved for file errors
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks the end of the range of error codes reserved for file errors
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks the start of the range of error codes reserved for validation errors.
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks the start and end of the range of error codes reserved for validation errors.
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks the start of the range of error codes reserved for formatting errors.
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
Marks end of the range of error codes reserved for formatting errors.
Available in OS X v10.4 and later.
Declared in
FoundationErrors.h
. -
An error was encountered while parsing the property list.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
The version number of the property list is unable to be determined.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
An stream error was encountered while reading the property list.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
An stream error was encountered while writing the property list.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
Marks beginning of the range of error codes reserved for property list errors.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
Marks end of the range of error codes reserved for property list errors.
Available in OS X v10.6 and later.
Declared in
FoundationErrors.h
. -
Marks beginning of the range of error codes reserved for errors related to executable files.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Executable is of a type that is not loadable in the current process.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Executable does not provide an architecture compatible with the current process.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Executable has Objective C runtime information incompatible with the current process.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Executable cannot be loaded for some other reason, such as a problem with a library it depends on.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Executable fails due to linking issues.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
. -
Marks end of the range of error codes reserved for errors related to executable files.
Available in OS X v10.5 and later.
Declared in
FoundationErrors.h
.
NSFileNoSuchFileError
NSFileLockingError
NSFileReadUnknownError
NSFileReadNoPermissionError
NSFileReadInvalidFileNameError
NSFileReadCorruptFileError
NSFileReadNoSuchFileError
NSFileReadInapplicableStringEncodingError
NSFileReadUnsupportedSchemeError
NSFileReadTooLargeError
NSFileReadUnknownStringEncodingError
NSFileWriteUnknownError
NSFileWriteNoPermissionError
NSFileWriteInvalidFileNameError
NSFileWriteFileExistsError
NSFileWriteInapplicableStringEncodingError
NSFileWriteUnsupportedSchemeError
NSFileWriteOutOfSpaceError
NSFileWriteVolumeReadOnlyError
NSKeyValueValidationError
NSFormattingError
NSUserCancelledError
NSFileErrorMinimum
NSFileErrorMaximum
NSValidationErrorMinimum
NSValidationErrorMaximum
NSFormattingErrorMinimum
NSFormattingErrorMaximum
NSPropertyListReadCorruptError
NSPropertyListReadUnknownVersionError
NSPropertyListReadStreamError
NSPropertyListWriteStreamError
NSPropertyListErrorMinimum
NSPropertyListErrorMaximum
NSExecutableErrorMinimum
NSExecutableNotLoadableError
NSExecutableArchitectureMismatchError
NSExecutableRuntimeMismatchError
NSExecutableLoadError
NSExecutableLinkError
NSExecutableErrorMaximum
Discussion
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.
Declared In
FoundationErrors.h
URL Loading System Error Codes
These values are returned as the error code property of an NSError
object with the domain “NSURLErrorDomain”.
enum { NSURLErrorUnknown = -1, NSURLErrorCancelled = -999, NSURLErrorBadURL = -1000, NSURLErrorTimedOut = -1001, NSURLErrorUnsupportedURL = -1002, NSURLErrorCannotFindHost = -1003, NSURLErrorCannotConnectToHost = -1004, NSURLErrorDataLengthExceedsMaximum = -1103, NSURLErrorNetworkConnectionLost = -1005, NSURLErrorDNSLookupFailed = -1006, NSURLErrorHTTPTooManyRedirects = -1007, NSURLErrorResourceUnavailable = -1008, NSURLErrorNotConnectedToInternet = -1009, NSURLErrorRedirectToNonExistentLocation = -1010, NSURLErrorBadServerResponse = -1011, NSURLErrorUserCancelledAuthentication = -1012, NSURLErrorUserAuthenticationRequired = -1013, NSURLErrorZeroByteResource = -1014, NSURLErrorCannotDecodeRawData = -1015, NSURLErrorCannotDecodeContentData = -1016, NSURLErrorCannotParseResponse = -1017, NSURLErrorInternationalRoamingOff = -1018, NSURLErrorCallIsActive = -1019, NSURLErrorDataNotAllowed = -1020, NSURLErrorRequestBodyStreamExhausted = -1021, NSURLErrorFileDoesNotExist = -1100, NSURLErrorFileIsDirectory = -1101, NSURLErrorNoPermissionsToReadFile = -1102, NSURLErrorSecureConnectionFailed = -1200, NSURLErrorServerCertificateHasBadDate = -1201, NSURLErrorServerCertificateUntrusted = -1202, NSURLErrorServerCertificateHasUnknownRoot = -1203, NSURLErrorServerCertificateNotYetValid = -1204, NSURLErrorClientCertificateRejected = -1205, NSURLErrorClientCertificateRequired = -1206, NSURLErrorCannotLoadFromNetwork = -2000, NSURLErrorCannotCreateFile = -3000, NSURLErrorCannotOpenFile = -3001, NSURLErrorCannotCloseFile = -3002, NSURLErrorCannotWriteToFile = -3003, NSURLErrorCannotRemoveFile = -3004, NSURLErrorCannotMoveFile = -3005, NSURLErrorDownloadDecodingFailedMidStream = -3006, NSURLErrorDownloadDecodingFailedToComplete = -3007 }
Constants
-
Returned when the URL Loading system encounters an error that it cannot interpret.
This can occur when an error originates from a lower level framework or library. Whenever this error code is received, it is a bug, and should be reported to Apple.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when an asynchronous load is canceled.
A Web Kit framework delegate will receive this error when it performs a cancel operation on a loading resource. Note that an
NSURLConnection
orNSURLDownload
delegate will not receive this error if the download is canceled.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a URL is sufficiently malformed that a URL request cannot be initiated
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when an asynchronous operation times out.
NSURLConnection
will send this error to its delegate when the timeoutInterval in NSURLRequest expires before a load can complete.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a properly formed URL cannot be handled by the framework.
The most likely cause is that there is no available protocol handler for the URL.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when the host name for a URL cannot be resolved.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when an attempt to connect to a host has failed.
This can occur when a host name resolves, but the host is down or may not be accepting connections on a certain port.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when the length of the resource data exceeds the maximum allowed.
Available in OS X v10.5 and later.
Declared in
NSURLError.h
. -
Returned when a client or server connection is severed in the middle of an in-progress load.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
See
NSURLErrorCannotFindHost
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a redirect loop is detected or when the threshold for number of allowable redirects has been exceeded (currently 16).
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a requested resource cannot be retrieved.
Examples are “file not found”, and data decoding problems that prevent data from being processed correctly.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a network resource was requested, but an internet connection is not established and cannot be established automatically, either through a lack of connectivity, or by the user's choice not to make a network connection automatically.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a redirect is specified by way of server response code, but the server does not accompany this code with a redirect URL.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when the URL Loading system receives bad data from the server.
This is equivalent to the “500 Server Error” message sent by HTTP servers.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when an asynchronous request for authentication is cancelled by the user.
This is typically incurred by clicking a “Cancel” button in a username/password dialog, rather than the user making an attempt to authenticate.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when authentication is required to access a resource.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a server reports that a URL has a non-zero content length, but terminates the network connection “gracefully” without sending any data.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when content data received during an NSURLConnection request cannot be decoded for a known content encoding.
Available in OS X v10.5 and later.
Declared in
NSURLError.h
. -
Returned when content data received during an NSURLConnection request has an unknown content encoding.
Available in OS X v10.5 and later.
Declared in
NSURLError.h
. -
Returned when a response to an NSURLConnection request cannot be parsed.
Available in OS X v10.5 and later.
Declared in
NSURLError.h
. -
Returned when a connection would require activating a data context while roaming, but international roaming is disabled.
Available in OS X v10.7 and later.
Declared in
NSURLError.h
. -
Returned when a connection is attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS).
Available in OS X v10.7 and later.
Declared in
NSURLError.h
. -
Returned when the cellular network disallows a connection.
Available in OS X v10.7 and later.
Declared in
NSURLError.h
. -
Returned when a body stream is needed but the client does not provide one. This impacts clients on iOS that send a POST request using a body stream but do not implement the NSURLConnection delegate method
connection:needNewBodyStream
.Available in OS X v10.7 and later.
Declared in
NSURLError.h
. -
Returned when a file does not exist.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a request for an FTP file results in the server responding that the file is not a plain file, but a directory.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a resource cannot be read due to insufficient permissions.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when an attempt to establish a secure connection fails for reasons which cannot be expressed more specifically.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a server certificate has a date which indicates it has expired, or is not yet valid.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a server certificate is signed by a root server which is not trusted.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a server certificate is not signed by any root server.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when a server certificate is not yet valid.
Available in OS X v10.4 and later.
Declared in
NSURLError.h
. -
Returned when a server certificate is rejected.
Available in OS X v10.4 and later.
Declared in
NSURLError.h
. -
Returned when a client certificate is required to authenticate an SSL connection during an NSURLConnection request.
Available in OS X v10.6 and later.
Declared in
NSURLError.h
. -
Returned when a specific request to load an item only from the cache cannot be satisfied.
This error is sent at the point when the library would go to the network accept for the fact that is has been blocked from doing so by the “load only from cache” directive.
Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
object was unable to create the downloaded file on disk due to a I/O failure.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
was unable to open the downloaded file on disk.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
was unable to close the downloaded file on disk.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
was unable to write to the downloaded file on disk.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
was unable to remove a downloaded file from disk.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
was unable to move a downloaded file on disk.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
failed to decode an encoded file during the download.Available in OS X v10.2 and later.
Declared in
NSURLError.h
. -
Returned when
NSURLDownload
failed to decode an encoded file after downloading.Available in OS X v10.2 and later.
Declared in
NSURLError.h
.
NSURLErrorUnknown
NSURLErrorCancelled
NSURLErrorBadURL
NSURLErrorTimedOut
NSURLErrorUnsupportedURL
NSURLErrorCannotFindHost
NSURLErrorCannotConnectToHost
NSURLErrorDataLengthExceedsMaximum
NSURLErrorNetworkConnectionLost
NSURLErrorDNSLookupFailed
NSURLErrorHTTPTooManyRedirects
NSURLErrorResourceUnavailable
NSURLErrorNotConnectedToInternet
NSURLErrorRedirectToNonExistentLocation
NSURLErrorBadServerResponse
NSURLErrorUserCancelledAuthentication
NSURLErrorUserAuthenticationRequired
NSURLErrorZeroByteResource
NSURLErrorCannotDecodeRawData
NSURLErrorCannotDecodeContentData
NSURLErrorCannotParseResponse
NSURLErrorInternationalRoamingOff
NSURLErrorCallIsActive
NSURLErrorDataNotAllowed
NSURLErrorRequestBodyStreamExhausted
NSURLErrorFileDoesNotExist
NSURLErrorFileIsDirectory
NSURLErrorNoPermissionsToReadFile
NSURLErrorSecureConnectionFailed
NSURLErrorServerCertificateHasBadDate
NSURLErrorServerCertificateUntrusted
NSURLErrorServerCertificateHasUnknownRoot
NSURLErrorServerCertificateNotYetValid
NSURLErrorClientCertificateRejected
NSURLErrorClientCertificateRequired
NSURLErrorCannotLoadFromNetwork
NSURLErrorCannotCreateFile
NSURLErrorCannotOpenFile
NSURLErrorCannotCloseFile
NSURLErrorCannotWriteToFile
NSURLErrorCannotRemoveFile
NSURLErrorCannotMoveFile
NSURLErrorDownloadDecodingFailedMidStream
NSURLErrorDownloadDecodingFailedToComplete
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLError.h
iCloud Error Codes
These error codes are used by error objects associated with the NSURLUbiquitousItemDownloadingErrorKey
on an NSURL
object when an iCloud-related error occurs.
NSUbiquitousFileErrorMinimum = 4352, NSUbiquitousFileUnavailableError = 4353, NSUbiquitousFileNotUploadedDueToQuotaError = 4354, NSUbiquitousFileUbiquityServerNotAvailable = 4355, NSUbiquitousFileErrorMaximum = 4607
Constants
-
The minimum error code value that represents an iCloud error.
Available in OS X v10.9 and later.
Declared in
FoundationErrors.h
. -
The item has not been uploaded to iCloud by another device yet.
When this error occurs, you do not need to ask the system to start downloading the item. The system will download the item as soon as it can. If you want to know when the item becomes available, use an
NSMetadataQuery
object to monitor changes to the file’s URL.Available in OS X v10.9 and later.
Declared in
FoundationErrors.h
. -
The item could not be uploaded to iCloud because it would make the account go over its quota.
Available in OS X v10.9 and later.
Declared in
FoundationErrors.h
. -
Connecting to the iCloud servers failed.
Available in OS X v10.9 and later.
Declared in
FoundationErrors.h
. -
The maximum error code value that represents an iCloud error.
Available in OS X v10.9 and later.
Declared in
FoundationErrors.h
.
NSUbiquitousFileErrorMinimum
NSUbiquitousFileUnavailableError
NSUbiquitousFileNotUploadedDueToQuotaError
NSUbiquitousFileUbiquityServerNotAvailable
NSUbiquitousFileErrorMaximum
XPC Errors
Errors returned by XPC connections. Note that these are not currently available on iOS.
NSXPCConnectionInterrupted = 4097, NSXPCConnectionInvalid = 4099, NSXPCConnectionReplyInvalid = 4101, NSXPCConnectionErrorMinimum = 4096, NSXPCConnectionErrorMaximum = 4224
Constants
-
The XPC connection was interrupted.
Available in OS X v10.8 and later.
Declared in
FoundationErrors.h
. -
The XPC connection was invalid.
Available in OS X v10.8 and later.
Declared in
FoundationErrors.h
. -
The XPC connection reply was invalid.
Available in OS X v10.8 and later.
Declared in
FoundationErrors.h
. -
The XPC connection minimum error.
Available in OS X v10.8 and later.
Declared in
FoundationErrors.h
. -
The XPC connection maximum error.
Available in OS X v10.8 and later.
Declared in
FoundationErrors.h
. -
NSXPCConnectionInterrupted
NSXPCConnectionInvalid
NSXPCConnectionReplyInvalid
NSXPCConnectionErrorMinimum
NSXPCConnectionErrorMaximum