草庐IT

NSURLErrorUserCancelledAuthentica

全部标签

iphone - iOS:我如何接收 HTTP 401 而不是 -1012 NSURLErrorUserCancelledAuthentication

我遇到的问题与以下链接中描述的问题类似。NSHTTPURLResponsestatusCodeisreturningzerowhenitshouldbe401我使用[NSURLConnectionsendSynchronousRequest:returningResponse:error:]从服务器获取数据。当NSURLConnection接收到HTTP代码401时,它除了从NSURLErrorDomain返回一个代码为-1012的错误对象外,不返回任何内容。-1012对应NSURLErrorUserCancelledAuthentication。因为我必须解析HTTPheader,所