NSHTTPURLResponse statusCode is returning zero whe

2019-04-12 08:47发布

Possible Duplicate:
iOS: How can i receive HTTP 401 instead of -1012 NSURLErrorUserCancelledAuthentication

Just doing a normal HTTP post with a NSMutableURLRequest and sendSynchronousRequest. But the NSHTTPURLResponse object I pass in has a statusCode of zero after the call. I get this error:

Error Domain=NSURLErrorDomain Code=-1012 UserInfo=0x4d3b3c0 "Operation could not be completed. (NSURLErrorDomain error -1012.)"

but no status code. Why? The status code the server is sending is 401.

1条回答
放我归山
2楼-- · 2019-04-12 09:43

I don't have a solution to the problem, but here is a list of NSURLErrorDomain codes of which -1012 refers to NSURLErrorUserCancelledAuthentication, if that helps narrow down the cause.

查看更多
登录 后发表回答