URL Loading System Error Codes

These values are returned as the error code property of an NSError object with the domain “NSURLErrorDomain”.

Symbols

Constants

var NSURLErrorUnknown: Int

Returned when the URL Loading system encounters an error that it cannot interpret.

var NSURLErrorCancelled: Int

Returned when an asynchronous load is canceled.

var NSURLErrorBadURL: Int

Returned when a URL is sufficiently malformed that a URL request cannot be initiated

var NSURLErrorTimedOut: Int

Returned when an asynchronous operation times out.

var NSURLErrorUnsupportedURL: Int

Returned when a properly formed URL cannot be handled by the framework.

var NSURLErrorCannotFindHost: Int

Returned when the host name for a URL cannot be resolved.

var NSURLErrorCannotConnectToHost: Int

Returned when an attempt to connect to a host has failed.

var NSURLErrorDataLengthExceedsMaximum: Int

Returned when the length of the resource data exceeds the maximum allowed.

var NSURLErrorNetworkConnectionLost: Int

Returned when a client or server connection is severed in the middle of an in-progress load.

var NSURLErrorHTTPTooManyRedirects: Int

Returned when a redirect loop is detected or when the threshold for number of allowable redirects has been exceeded (currently 16).

var NSURLErrorResourceUnavailable: Int

Returned when a requested resource cannot be retrieved.

var NSURLErrorNotConnectedToInternet: Int

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.

var NSURLErrorRedirectToNonExistentLocation: Int

Returned when a redirect is specified by way of server response code, but the server does not accompany this code with a redirect URL.

var NSURLErrorBadServerResponse: Int

Returned when the URL Loading system receives bad data from the server.

var NSURLErrorUserCancelledAuthentication: Int

Returned when an asynchronous request for authentication is cancelled by the user.

var NSURLErrorUserAuthenticationRequired: Int

Returned when authentication is required to access a resource.

var NSURLErrorZeroByteResource: Int

Returned when a server reports that a URL has a non-zero content length, but terminates the network connection “gracefully” without sending any data.

var NSURLErrorCannotDecodeRawData: Int

Returned when content data received during an NSURLConnection request cannot be decoded for a known content encoding.

var NSURLErrorCannotDecodeContentData: Int

Returned when content data received during an NSURLConnection request has an unknown content encoding.

var NSURLErrorCannotParseResponse: Int

Returned when a response to an NSURLConnection request cannot be parsed.

var NSURLErrorInternationalRoamingOff: Int

Returned when a connection would require activating a data context while roaming, but international roaming is disabled.

var NSURLErrorCallIsActive: Int

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).

var NSURLErrorDataNotAllowed: Int

Returned when the cellular network disallows a connection.

var NSURLErrorRequestBodyStreamExhausted: Int

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.

var NSURLErrorFileDoesNotExist: Int

Returned when a file does not exist.

var NSURLErrorFileIsDirectory: Int

Returned when a request for an FTP file results in the server responding that the file is not a plain file, but a directory.

var NSURLErrorNoPermissionsToReadFile: Int

Returned when a resource cannot be read due to insufficient permissions.

var NSURLErrorSecureConnectionFailed: Int

Returned when an attempt to establish a secure connection fails for reasons which cannot be expressed more specifically.

var NSURLErrorServerCertificateHasBadDate: Int

Returned when a server certificate has a date which indicates it has expired, or is not yet valid.

var NSURLErrorServerCertificateUntrusted: Int

Returned when a server certificate is signed by a root server which is not trusted.

var NSURLErrorServerCertificateHasUnknownRoot: Int

Returned when a server certificate is not signed by any root server.

var NSURLErrorServerCertificateNotYetValid: Int

Returned when a server certificate is not yet valid.

var NSURLErrorClientCertificateRejected: Int

Returned when a server certificate is rejected.

var NSURLErrorClientCertificateRequired: Int

Returned when a client certificate is required to authenticate an SSL connection during an NSURLConnection request.

var NSURLErrorCannotLoadFromNetwork: Int

Returned when a specific request to load an item only from the cache cannot be satisfied.

var NSURLErrorCannotCreateFile: Int

Returned when NSURLDownload object was unable to create the downloaded file on disk due to a I/O failure.

var NSURLErrorCannotOpenFile: Int

Returned when NSURLDownload was unable to open the downloaded file on disk.

var NSURLErrorCannotCloseFile: Int

Returned when NSURLDownload was unable to close the downloaded file on disk.

var NSURLErrorCannotWriteToFile: Int

Returned when NSURLDownload was unable to write to the downloaded file on disk.

var NSURLErrorCannotRemoveFile: Int

Returned when NSURLDownload was unable to remove a downloaded file from disk.

var NSURLErrorCannotMoveFile: Int

Returned when NSURLDownload was unable to move a downloaded file on disk.

var NSURLErrorDownloadDecodingFailedMidStream: Int

Returned when NSURLDownload failed to decode an encoded file during the download.

var NSURLErrorDownloadDecodingFailedToComplete: Int

Returned when NSURLDownload failed to decode an encoded file after downloading.

var NSURLErrorAppTransportSecurityRequiresSecureConnection: Intvar NSURLErrorBackgroundSessionInUseByAnotherProcess: Intvar NSURLErrorBackgroundSessionRequiresSharedContainer: Intvar NSURLErrorBackgroundSessionWasDisconnected: Int