Enumeration

URL Loading System Error Codes

Error codes returned by URL loading APIs.

Declaration

enum : NSInteger {
    ...
};

Overview

These error codes are for NSError objects in the domain NSURLErrorDomain.

Topics

Error Codes

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.

NSURLErrorDataLengthExceedsMaximum

The length of the resource data exceeded the maximum allowed.

NSURLErrorDataNotAllowed

The cellular network disallowed a connection.

NSURLErrorDNSLookupFailed

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

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.

See Also

Errors

URL Loading System Error Info Keys

Recognize these keys from the user info dictionary of error objects produced by URL Loading APIs.

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