Titus
Titus

Reputation: 927

Do we have a list of NSURL Error Code Values given by Apple somewhere?

Can someone post the value for the list of possible NSURLError codes. I am getting -1004 as the error code value, I can see based on the description it is "Could not connect to the server", but is there any list of error number and information combination of NSURL?

Upvotes: 0

Views: 464

Answers (2)

Joakim Danielson
Joakim Danielson

Reputation: 51910

In Xcode, press Cmd-Shift-O (the letter) or select File -> Open Quickly... and start typing nsurlerror in the text field. Once you see it in the list select NSURLError.h to view all error definitions in the Xcode editor.

enter image description here

Upvotes: 0

Titus
Titus

Reputation: 927

Following is the list I collected by printing all the NSURL Error codes in debug window. Hope this helps someone, but it is just for quick reference, it will be always better to print the actual error description to confirm

ErrorCode   Enum Value
-1      NSURLErrorUnknown
-995    NSURLErrorBackgroundSessionRequiresSharedContainer
-996    NSURLErrorBackgroundSessionInUseByAnotherProcess
-997    NSURLErrorBackgroundSessionWasDisconnected
-999    NSURLErrorCancelled
-1000   NSURLErrorBadURL
-1001   NSURLErrorTimedOut
-1002   NSURLErrorUnsupportedURL
-1003   NSURLErrorCannotFindHost
-1004   NSURLErrorCannotConnectToHost
-1005   NSURLErrorNetworkConnectionLost
-1006   NSURLErrorDNSLookupFailed
-1007   NSURLErrorHTTPTooManyRedirects
-1008   NSURLErrorResourceUnavailable
-1009   NSURLErrorNotConnectedToInternet
-1010   NSURLErrorRedirectToNonExistentLocation
-1011   NSURLErrorBadServerResponse
-1012   NSURLErrorUserCancelledAuthentication
-1013   NSURLErrorUserAuthenticationRequired
-1014   NSURLErrorZeroByteResource
-1015   NSURLErrorCannotDecodeRawData
-1016   NSURLErrorCannotDecodeContentData
-1017   NSURLErrorCannotParseResponse
-1018   NSURLErrorInternationalRoamingOff
-1019   NSURLErrorCallIsActive
-1020   NSURLErrorDataNotAllowed
-1021   NSURLErrorRequestBodyStreamExhausted
-1022   NSURLErrorAppTransportSecurityRequiresSecureConnection
-1100   NSURLErrorFileDoesNotExist
-1101   NSURLErrorFileIsDirectory
-1102   NSURLErrorNoPermissionsToReadFile
-1103   NSURLErrorDataLengthExceedsMaximum
-1104   NSURLErrorFileOutsideSafeArea
-1200   NSURLErrorSecureConnectionFailed
-1201   NSURLErrorServerCertificateHasBadDate
-1202   NSURLErrorServerCertificateUntrusted
-1203   NSURLErrorServerCertificateHasUnknownRoot
-1204   NSURLErrorServerCertificateNotYetValid
-1205   NSURLErrorClientCertificateRejected
-1206   NSURLErrorClientCertificateRequired
-2000   NSURLErrorCannotLoadFromNetwork
-3000   NSURLErrorCannotCreateFile
-3001   NSURLErrorCannotOpenFile
-3002   NSURLErrorCannotCloseFile
-3003   NSURLErrorCannotWriteToFile
-3004   NSURLErrorCannotRemoveFile
-3005   NSURLErrorCannotMoveFile
-3006   NSURLErrorDownloadDecodingFailedMidStream
-3007   NSURLErrorDownloadDecodingFailedToComplete

Upvotes: 1

Related Questions