问题1:Code=3840错误
Error Domain=NSCocoaErrorDomain Code=3840
"JSON text did not start with array or object and option to allow fragments not set."
UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.,
NSUnderlyingError=0x17105df10 {Error Domain=com.alamofire.error.serialization.response Code=-1011 "
Request failed: internal server error (500)" UserInfo={com.alamofire.serialization.response.error.
response=<NSHTTPURLResponse: 0x170622420> { URL: http://syspd.w-oasis.com/urcarAppRmiServlet } { status code: 500, headers {
Server = Apache-Coyote/1.1,
Content-Type = text/html;charset=utf-8,
Set-Cookie = JSESSIONID=4D96EDA3BF1417BA495D6920EBE44CC7; Path=/; HttpOnly,
Content-Language = en,
Vary = Accept-Encoding,
Date = Fri, 14 Oct 2016 07:27:36 GMT,
Content-Encoding = gzip,
Content-Length = 848,
Connection = close
} },
解决办法:
//设置请求格式
manager.requestSerializer = [AFJSONRequestSerializer serializer];
//设置返回格式
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
问题2:Code=-1016 错误
Error Domain=com.alamofire.error.serialization.response Code=-1016
"Request failed: unacceptable content-type: text/plain"
UserInfo={com.alamofire.serialization.response.error.
response=<NSHTTPURLResponse: 0x174227f20> { URL: http://syspd.w-oasis.com/urcarAppRmiServlet }
{ status code: 200, headers {
Keep-Alive = timeout=5, max=100,
Content-Length = 205,
Connection = Keep-Alive,
Server = Apache-Coyote/1.1,
Date = Fri, 14 Oct 2016 07:31:16 GMT
} }
问题3:code: 503
{ status code: 503, headers {
Cache-Control = must-revalidate,no-cache,no-store;
Content-Type = text/html;charset=ISO-8859-1;
Content-Length = 925;
Server = Charles;
Proxy-Connection = Close;
}
解决办法:可能是断网了,请重新连接!😄