ios中网络请求error错误汇总

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


Error Code Description
1 </br> kCFHostErrorHostNotFound “Indicates that the DNS lookup failed.”
2 </br> 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 </br> 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 </br> 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 Code Description
110 </br> kCFSOCKS4ErrorRequestFailed “Request rejected or failed by the server.”
111 </br> kCFSOCKS4ErrorIdentdFailed “Request rejected because SOCKS server cannot connect to identd on the client.”
112 </br> kCFSOCKS4ErrorIdConflict “Request rejected because the client program and identd report different user-ids.”
113 </br> kCFSOCKS4ErrorUnknownStatusCode “The status code returned by the server is unknown.”

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

HTTP Code Description
300 </br>kCFErrorHTTPAuthenticationTypeUnsupported “The client and server could not agree on a supported authentication type.”
301 </br> kCFErrorHTTPBadCredentials “The credentials provided for an authenticated connection were rejected by the server.”
302 </br> kCFErrorHTTPConnectionLost “The connection to the server was dropped. This usually indicates a highly overloaded server.”
303 </br> kCFErrorHTTPParseFailure “The HTTP server response could not be parsed.”
304 </br>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 </br> kCFErrorHTTPBadURL “The requested URL could not be retrieved.”
306 </br> kCFErrorHTTPProxyConnectionFailure “A connection could not be established to the HTTP proxy.”
307 </br> kCFErrorHTTPBadProxyCredentials “The authentication credentials provided for logging into the proxy were rejected.”
308 </br> kCFErrorPACFileError “An error occurred with the proxy autoconfiguration file.”
309</br> kCFErrorPACFileAuth “The authentication credentials provided by the proxy autoconfiguration file were rejected.”
310 </br> kCFErrorHTTPSProxyConnectionFailure “A connection could not be established to the HTTPS proxy.”
311 </br> kCFStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethod “The HTTPS proxy returned an unexpected status code, such as a 3xx redirect.”

CFURLConnection Code Description
-998 </br> kCFURLErrorUnknown “An unknown error occurred.”
-999 </br> kCFURLErrorCancelled </br>NSURLErrorCancelled “The connection was cancelled.”
-1000</br>kCFURLErrorBadURL</br>NSURLErrorBadURL “The connection failed due to a malformed URL.”
-1001</br>kCFURLErrorTimedOut</br>NSURLErrorTimedOut “The connection timed out.”
-1002</br>kCFURLErrorUnsupportedURL</br>NSURLErrorUnsupportedURL “The connection failed due to an unsupported URL scheme.”
-1003</br>kCFURLErrorCannotFindHost</br>NSURLErrorCannotFindHost “The connection failed because the host could not be found.”
-1004</br>kCFURLErrorCannotConnectToHost</br>NSURLErrorCannotConnectToHost “The connection failed because a connection cannot be made to the host.”
-1005</br>kCFURLErrorNetworkConnectionLost</br>NSURLErrorNetworkConnectionLost “The connection failed because the network connection was lost.”
-1006</br>kCFURLErrorDNSLookupFailed</br>NSURLErrorDNSLookupFailed “The connection failed because the DNS lookup failed.”
-1007</br>kCFURLErrorHTTPTooManyRedirects</br>NSURLErrorHTTPTooManyRedirects “The HTTP connection failed due to too many redirects.”
-1008</br>kCFURLErrorResourceUnavailable</br>NSURLErrorResourceUnavailable “The connection’s resource is unavailable.”
-1009</br>kCFURLErrorNotConnectedToInternet</br>NSURLErrorNotConnectedToInternet “The connection failed because the device is not connected to the internet.”
-1010</br>kCFURLErrorRedirectToNonExistentLocation</br>NSURLErrorRedirectToNonExistentLocation “The connection was redirected to a nonexistent location.”
-1011</br>kCFURLErrorBadServerResponse</br>NSURLErrorBadServerResponse “The connection received an invalid server response.”
-1012</br>kCFURLErrorUserCancelledAuthentication</br>NSURLErrorUserCancelledAuthentication “The connection failed because the user cancelled required authentication.”
-1013</br>kCFURLErrorUserAuthenticationRequired</br>NSURLErrorUserAuthenticationRequired “The connection failed because authentication is required.”
-1014</br>kCFURLErrorZeroByteResource</br>NSURLErrorZeroByteResource “The resource retrieved by the connection is zero bytes.”
-1015</br>kCFURLErrorCannotDecodeRawData</br>NSURLErrorCannotDecodeRawData “The connection cannot decode data encoded with a known content encoding.”
1016</br>kCFURLErrorCannotDecodeContentData</br>NSURLErrorCannotDecodeContentData “The connection cannot decode data encoded with an unknown content encoding.”
-1017</br>kCFURLErrorCannotParseResponse</br>NSURLErrorCannotParseResponse “The connection cannot parse the server’s response.”
-1018</br> kCFURLErrorInternationalRoamingOff “The connection failed because international roaming is disabled on the device.”
-1019</br> kCFURLErrorCallIsActive “The connection failed because a call is active.”
-1020</br> kCFURLErrorDataNotAllowed “The connection failed because data use is currently not allowed on the device.”
-1021</br> kCFURLErrorRequestBodyStreamExhausted “The connection failed because its request’s body stream was exhausted.”

File Code Description
-1100</br>kCFURLErrorFileDoesNotExist</br>NSURLErrorFileDoesNotExist “The file operation failed because the file does not exist.”
-1101</br>kCFURLErrorFileIsDirectory</br>NSURLErrorFileIsDirectory “The file operation failed because the file is a directory.”
-1102</br>kCFURLErrorNoPermissionsToReadFile</br>NSURLErrorNoPermissionsToReadFile “The file operation failed because it does not have permission to read the file.”
-1103</br>kCFURLErrorDataLengthExceedsMaximum</br>NSURLErrorDataLengthExceedsMaximum “The file operation failed because the file is too large.”

SSL Code Description
-1200</br>kCFURLErrorSecureConnectionFailed</br>NSURLErrorSecureConnectionFailed “The secure connection failed for an unknown reason.”
-1201</br>kCFURLErrorServerCertificateHasBadDate</br>NSURLErrorServerCertificateHasBadDate “The secure connection failed because the server’s certificate has an invalid date.”
-1202</br>kCFURLErrorServerCertificateUntrusted</br>NSURLErrorServerCertificateUntrusted “The secure connection failed because the server’s certificate is not trusted.”
-1203</br>kCFURLErrorServerCertificateHasUnknownRoot</br>NSURLErrorServerCertificateHasUnknownRoot “The secure connection failed because the server’s certificate has an unknown root.”
-1204</br>kCFURLErrorServerCertificateNotYetValid</br>NSURLErrorServerCertificateNotYetValid “The secure connection failed because the server’s certificate is not yet valid.”
-1205</br>kCFURLErrorClientCertificateRejected</br>NSURLErrorClientCertificateRejected “The secure connection failed because the client’s certificate was rejected.”
-1206</br>kCFURLErrorClientCertificateRequired</br>NSURLErrorClientCertificateRequired “The secure connection failed because the server requires a client certificate.”

Download I/O Code Description
-2000</br>kCFURLErrorCannotLoadFromNetwork</br>NSURLErrorCannotLoadFromNetwork “The connection failed because it is being required to return a cached resource, but one is not available.”
-3000</br>kCFURLErrorCannotCreateFile</br>NSURLErrorCannotCreateFile “The file cannot be created.”
-3001</br>kCFURLErrorCannotOpenFile</br>NSURLErrorCannotOpenFile “The file cannot be opened.”
-3002</br>kCFURLErrorCannotCloseFile</br>NSURLErrorCannotCloseFile “The file cannot be closed.”
-3003</br>kCFURLErrorCannotWriteToFile</br>NSURLErrorCannotWriteToFile “The file cannot be written.”
-3004</br>kCFURLErrorCannotRemoveFile</br>NSURLErrorCannotRemoveFile “The file cannot be removed.”
-3005</br>kCFURLErrorCannotMoveFile</br>NSURLErrorCannotMoveFile “The file cannot be moved.”
-3006</br>kCFURLErrorDownloadDecodingFailedMidStream</br>NSURLErrorDownloadDecodingFailedMidStream “The download failed because decoding of the downloaded data failed mid-stream.”
-3007</br>kCFURLErrorDownloadDecodingFailedToComplete</br>NSURLErrorDownloadDecodingFailedToComplete “The download failed because decoding of the downloaded data failed to complete.”
3840 “JSON text did not start with array or object and option to allow fragments not set.”

Cookie Code Description
-4000</br>kCFHTTPCookieCannotParseCookieFile “The cookie file cannot be parsed.”

CFNetServices Code Description
-72000L</br> kCFNetServiceErrorUnknown “An unknown error occurred.”
72001L</br> kCFNetServiceErrorCollision “An attempt was made to use a name that is already in use.”
-72002L</br> kCFNetServiceErrorNotFound “Not used.”
72003L</br>kCFNetServiceErrorInProgress “A new search could not be started because a search is already in progress.”
-72004L</br> kCFNetServiceErrorBadArgument “A required argument was not provided or was not valid.”
-72005L</br> kCFNetServiceErrorCancel “The search or service was cancelled.”
-72006L</br> kCFNetServiceErrorInvalid “Invalid data was passed to a CFNetServices function.”
-72007L</br> kCFNetServiceErrorTimeout “A search failed because it timed out.”
-73000L</br> kCFNetServiceErrorDNSServiceFailure “An error from DNS discovery; look at kCFDNSServiceFailureKey to get the error number and interpret using dnssd.h”
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,319评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,801评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,567评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,156评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,019评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,090评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,500评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,192评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,474评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,566评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,338评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,212评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,572评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,890评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,169评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,478评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,661评论 2 335

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,494评论 18 139
  • ·错误:1000 SQLSTATE: HY000 (ER_HASHCHK)消息:hashchk·错误:1001 S...
    Catke阅读 1,615评论 0 2
  • 错误:1000 SQLSTATE: HY000 (ER_HASHCHK)消息:hashchk 错误:1001 SQ...
    灼灼2015阅读 23,477评论 0 6
  • error code(错误代码)=0是操作成功完成。error code(错误代码)=1是功能错误。error c...
    Heikki_阅读 3,316评论 1 9
  • 在iOS开发中经常会遇到网络请求的错误, 一方面可能会是自己网络请求的方式, 参数, 请求头等造成的; 另一方面可...
    火之玉阅读 11,524评论 0 12