Error using afnetworking request

Source: Internet
Author: User

One, request timeout

connection error returned by error:error domain=nsurlerrordomain code=-1001 " The request timed out. "userinfo={nsunderlyingerror=0x1408a8eb0 {Error domain=kcferrordomaincfnetwork code=-1001" (null) userinfo={_kcfstreamerrorcodekey=-2102, _kcfstreamerrordomainkey=4}}, nserrorfailingurlstringkey=http:// 192.168.80.80:8081/router, Nserrorfailingurlkey=http://192.168.80.80:8081/router, _kCFStreamErrorDomainKey=4, _ kcfstreamerrorcodekey=-2102, nslocalizeddescription= request timed out. }

It was always possible to request on the emulator, but when it came to the real machine test, it always gave me an error: The request timed out and no requests were sent out. I and backstage personnel to debug stand-alone, is also useless, the backstage staff told me that the request did not jump into his breakpoint.

The final troubleshooting reasons are: My simulator and computer are connected to the company's internal wireless network, while the mobile phone is connected to the guests of the wireless network, two wireless network is not the same segment (Network segment (network segment) generally refers to a computer network using the same physical layer equipment (transmission media, Repeater, hubs, etc.), which is able to communicate directly to the part of the end, I sought to get the tube and the simulator on the same wireless network password, the connection really successful request.


second, the request header error

connection error returned by error:error domain=com.alamofire.error.serialization.response code=-1011 "Request Failed:bad Gateway (502)" userinfo={nsunderlyingerror=0x128932860 {Error domain=com.alamofire.error.serialization.response Code=-1016 " Request failed:unacceptable Content-type:text/plain "userinfo={ com.alamofire.serialization.response.error.response=<nshttpurlresponse:0x1288bad80> {url:http:// 192.168.20.52/router} {Status code:502, headers {

"Content-length" =;

Server = zteose;

} , Nserrorfailingurlkey=http://192.168.20.52/router, com.alamofire.serialization.response.error.data=< 556e6b6e 6f776e20 53657276 65722045 72726f72> nslocalizeddescription=request failed:unacceptable: Text/plain}}, com.alamofire.serialization.response.error.response=<nshttpurlresponse:0x1288bad80> {URL: Http://192.168.20.52/router} {Status code:502, headers {

"Content-length" =;

Server = zteose;

} , Nserrorfailingurlkey=http://192.168.20.52/router, com.alamofire.serialization.response.error.data=< 556e6b6e 6f776e20 53657276 65722045 72726f72> nslocalizeddescription=request Failed:bad Gateway (502)} This is an error in the request header format, just set the request header format when sending the request

[Manager.requestserislizer setvalue:@ "Application/json" forhttpheaderfield:@ "Content-type"];

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.