iOS errorcode为-1011 问题及解答

来源:互联网 发布:淘宝网天猫购裱画材料 编辑:程序博客网 时间:2024/06/14 01:08
在程序执行中发现错误,请求时请求数据并没有被服务器接收

查看error信息

Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x13e764750> { URL: http://192.168.1.122:8080/dongci/app/finshedItem } { status code: 500, headers {    Connection = close;    "Content-Length" = 93;    "Content-Type" = "application/json;charset=UTF-8";    Date = "Thu, 21 Jul 2016 05:09:59 GMT";    Server = "Apache-Coyote/1.1";} }, NSErrorFailingURLKey=http://192.168.1.122:8080/dongci/app/finshedItem, com.alamofire.serialization.response.error.data=<0a7b0a20 20226572 72223a20 7b0a2020 20202263 6f646522 3a203530 302c0a20 20202022 6d736722 3a2022e6 97a0e6b3 95e5a484 e79086e6 82a8e79a 84e8afb7 e6b18222 2c0a2020 20202265 76656e74 6964223a 2022220a 20207d0a 7d>, NSLocalizedDescription=Request failed: internal server error (500)}


去官方文档上查看错误原因

NSURLErrorBadServerResponse
Returned when the URL Loading system receives bad data from the server.
This is equivalent to the “500 Server Error” message sent by HTTP servers.

Available in OS X v10.2 and later.


出现这个问题,从错误信息中找到了答案Request failed: internal server error (500),这里所指的是服务端内部错误。向服务端请求查看错误,服务端查看错的方法:
1.查看tomcat控制台输出日志,从这里可以查看出tomcat这个应用是不是向服务端发送请求了,
2.查看tomcat的log日志,这里可以查看出代码到底错在哪里,什么原因导致的
我这里出现的问题是数据库中,主键冲突的原因导致报错,解决方案我就不详细说明了

1 0