ios中网络请求error错误汇总

在网络请求的时候会遇到很多请求错误, AFN会返回error错误的代码 ,整理出来方便查询
:)
也可以参考维基维基百科 List of HTTP status codes


Error CodeDescription
1 kCFHostErrorHostNotFound“Indicates that the DNS lookup failed.”
2 kCFHostErrorUnknown“An unknown error occurred (a name server failure, for example). For additional information, query the kCFGetAddrInfoFailureKey to get the value returned from getaddrinfo; lookup in netdb.h”
100 kCFSOCKSErrorUnknownClientVersion“The SOCKS server rejected access because it does not support connections with the requested SOCKS version.Query kCFSOCKSStatusCodeKey to recover the status code returned by the server.”
101 kCFSOCKSErrorUnsupportedServerVersion“The version of SOCKS requested by the server is not supported. Query kCFSOCKSStatusCodeKey to recover the status code returned by the server. Query the kCFSOCKSVersionKey to find the version requested by the server.”

SOCKS4 CodeDescription
110 kCFSOCKS4ErrorRequestFailed“Request rejected or failed by the server.”
111 kCFSOCKS4ErrorIdentdFailed“Request rejected because SOCKS server cannot connect to identd on the client.”
112 kCFSOCKS4ErrorIdConflict“Request rejected because the client program and identd report different user-ids.”
113 kCFSOCKS4ErrorUnknownStatusCode“The status code returned by the server is unknown.”

SOCKS5 CodeDescription
120 kCFSOCKS5ErrorBadState“The stream is not in a state that allows the requested operation.”
121 kCFSOCKS5ErrorBadResponseAddr“The address type returned is not supported.”
122 kCFSOCKS5ErrorBadCredentials“The SOCKS server refused the client connection because of bad login credentials.”
123 kCFSOCKS5ErrorUnsupportedNegotiationMethod“The requested method is not supported. Query kCFSOCKSNegotiationMethodKey to find the method requested.”
124 kCFSOCKS5ErrorNoAcceptableMethod“The client and server could not find a mutually agreeable authentication method.”

HTTP CodeDescription
300 kCFErrorHTTPAuthenticationTypeUnsupported“The client and server could not agree on a supported authentication type.”
301 kCFErrorHTTPBadCredentials“The credentials provided for an authenticated connection were rejected by the server.”
302 kCFErrorHTTPConnectionLost“The connection to the server was dropped. This usually indicates a highly overloaded server.”
303 kCFErrorHTTPParseFailure“The HTTP server response could not be parsed.”
304 kCFErrorHTTPRedirectionLoopDetected“Too many HTTP redirects occurred before reaching a page that did not redirect the client to another page. This usually indicates a redirect loop.”
305 kCFErrorHTTPBadURL“The requested URL could not be retrieved.”
306 kCFErrorHTTPProxyConnectionFailure“A connection could not be established to the HTTP proxy.”
307 kCFErrorHTTPBadProxyCredentials“The authentication credentials provided for logging into the proxy were rejected.”
308 kCFErrorPACFileError“An error occurred with the proxy autoconfiguration file.”
309 kCFErrorPACFileAuth“The authentication credentials provided by the proxy autoconfiguration file were rejected.”
310 kCFErrorHTTPSProxyConnectionFailure“A connection could not be established to the HTTPS proxy.”
311 kCFStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethod“The HTTPS proxy returned an unexpected status code, such as a 3xx redirect.”

CFURLConnection CodeDescription
-998 kCFURLErrorUnknown“An unknown error occurred.”
-999 kCFURLErrorCancelled NSURLErrorCancelled“The connection was cancelled.”
-1000kCFURLErrorBadURLNSURLErrorBadURL“The connection failed due to a malformed URL.”
-1001kCFURLErrorTimedOutNSURLErrorTimedOut“The connection timed out.”
-1002kCFURLErrorUnsupportedURLNSURLErrorUnsupportedURL“The connection failed due to an unsupported URL scheme.”
-1003kCFURLErrorCannotFindHostNSURLErrorCannotFindHost“The connection failed because the host could not be found.”
-1004kCFURLErrorCannotConnectToHostNSURLErrorCannotConnectToHost“The connection failed because a connection cannot be made to the host.”
-1005kCFURLErrorNetworkConnectionLostNSURLErrorNetworkConnectionLost“The connection failed because the network connection was lost.”
-1006kCFURLErrorDNSLookupFailedNSURLErrorDNSLookupFailed“The connection failed because the DNS lookup failed.”
-1007kCFURLErrorHTTPTooManyRedirectsNSURLErrorHTTPTooManyRedirects“The HTTP connection failed due to too many redirects.”
-1008kCFURLErrorResourceUnavailableNSURLErrorResourceUnavailable“The connection’s resource is unavailable.”
-1009kCFURLErrorNotConnectedToInternetNSURLErrorNotConnectedToInternet“The connection failed because the device is not connected to the internet.”
-1010kCFURLErrorRedirectToNonExistentLocationNSURLErrorRedirectToNonExistentLocation“The connection was redirected to a nonexistent location.”
-1011kCFURLErrorBadServerResponseNSURLErrorBadServerResponse“The connection received an invalid server response.”
-1012kCFURLErrorUserCancelledAuthenticationNSURLErrorUserCancelledAuthentication“The connection failed because the user cancelled required authentication.”
-1013kCFURLErrorUserAuthenticationRequiredNSURLErrorUserAuthenticationRequired“The connection failed because authentication is required.”
-1014kCFURLErrorZeroByteResourceNSURLErrorZeroByteResource“The resource retrieved by the connection is zero bytes.”
-1015kCFURLErrorCannotDecodeRawDataNSURLErrorCannotDecodeRawData“The connection cannot decode data encoded with a known content encoding.”
1016kCFURLErrorCannotDecodeContentDataNSURLErrorCannotDecodeContentData“The connection cannot decode data encoded with an unknown content encoding.”
-1017kCFURLErrorCannotParseResponseNSURLErrorCannotParseResponse“The connection cannot parse the server’s response.”
-1018 kCFURLErrorInternationalRoamingOff“The connection failed because international roaming is disabled on the device.”
-1019 kCFURLErrorCallIsActive“The connection failed because a call is active.”
-1020 kCFURLErrorDataNotAllowed“The connection failed because data use is currently not allowed on the device.”
-1021 kCFURLErrorRequestBodyStreamExhausted“The connection failed because its request’s body stream was exhausted.”

File CodeDescription
-1100kCFURLErrorFileDoesNotExistNSURLErrorFileDoesNotExist“The file operation failed because the file does not exist.”
-1101kCFURLErrorFileIsDirectoryNSURLErrorFileIsDirectory“The file operation failed because the file is a directory.”
-1102kCFURLErrorNoPermissionsToReadFileNSURLErrorNoPermissionsToReadFile“The file operation failed because it does not have permission to read the file.”
-1103kCFURLErrorDataLengthExceedsMaximumNSURLErrorDataLengthExceedsMaximum“The file operation failed because the file is too large.”

SSL CodeDescription
-1200kCFURLErrorSecureConnectionFailedNSURLErrorSecureConnectionFailed“The secure connection failed for an unknown reason.”
-1201kCFURLErrorServerCertificateHasBadDateNSURLErrorServerCertificateHasBadDate“The secure connection failed because the server’s certificate has an invalid date.”
-1202kCFURLErrorServerCertificateUntrustedNSURLErrorServerCertificateUntrusted“The secure connection failed because the server’s certificate is not trusted.”
-1203kCFURLErrorServerCertificateHasUnknownRootNSURLErrorServerCertificateHasUnknownRoot“The secure connection failed because the server’s certificate has an unknown root.”
-1204kCFURLErrorServerCertificateNotYetValidNSURLErrorServerCertificateNotYetValid“The secure connection failed because the server’s certificate is not yet valid.”
-1205kCFURLErrorClientCertificateRejectedNSURLErrorClientCertificateRejected“The secure connection failed because the client’s certificate was rejected.”
-1206kCFURLErrorClientCertificateRequiredNSURLErrorClientCertificateRequired“The secure connection failed because the server requires a client certificate.”

Download I/O CodeDescription
-2000kCFURLErrorCannotLoadFromNetworkNSURLErrorCannotLoadFromNetwork“The connection failed because it is being required to return a cached resource, but one is not available.”
-3000kCFURLErrorCannotCreateFileNSURLErrorCannotCreateFile“The file cannot be created.”
-3001kCFURLErrorCannotOpenFileNSURLErrorCannotOpenFile“The file cannot be opened.”
-3002kCFURLErrorCannotCloseFileNSURLErrorCannotCloseFile“The file cannot be closed.”
-3003kCFURLErrorCannotWriteToFileNSURLErrorCannotWriteToFile“The file cannot be written.”
-3004kCFURLErrorCannotRemoveFileNSURLErrorCannotRemoveFile“The file cannot be removed.”
-3005kCFURLErrorCannotMoveFileNSURLErrorCannotMoveFile“The file cannot be moved.”
-3006kCFURLErrorDownloadDecodingFailedMidStreamNSURLErrorDownloadDecodingFailedMidStream“The download failed because decoding of the downloaded data failed mid-stream.”
-3007kCFURLErrorDownloadDecodingFailedToCompleteNSURLErrorDownloadDecodingFailedToComplete“The download failed because decoding of the downloaded data failed to complete.”

Cookie CodeDescription
-4000kCFHTTPCookieCannotParseCookieFile“The cookie file cannot be parsed.”

CFNetServices CodeDescription
-72000L kCFNetServiceErrorUnknown“An unknown error occurred.”
72001L kCFNetServiceErrorCollision“An attempt was made to use a name that is already in use.”
-72002L kCFNetServiceErrorNotFound“Not used.”
72003LkCFNetServiceErrorInProgress“A new search could not be started because a search is already in progress.”
-72004L kCFNetServiceErrorBadArgument“A required argument was not provided or was not valid.”
-72005L kCFNetServiceErrorCancel“The search or service was cancelled.”
-72006L kCFNetServiceErrorInvalid“Invalid data was passed to a CFNetServices function.”
-72007L kCFNetServiceErrorTimeout“A search failed because it timed out.”
-73000L kCFNetServiceErrorDNSServiceFailure“An error from DNS discovery; look at kCFDNSServiceFailureKey to get the error number and interpret using dnssd.h”
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值