Possible Duplicate:
iOS: How can i receive HTTP 401 instead of -1012 NSURLErrorUserCancelledAuthenticationNSHTTPURLResponse的StatusCode將返回零當它應該是401
只是做了NSMutableURLRequest和sendSynchronousRequest正常的HTTP發佈。但是在調用之後,我傳入的NSHTTPURLResponse對象的statusCode爲零。我得到這個錯誤:
錯誤域= NSURLErrorDomain代碼= -1012 =的UserInfo 0x4d3b3c0 「操作無法完成(NSURLErrorDomain錯誤-1012)。」
,但沒有狀態代碼。爲什麼?服務器發送的狀態碼是401.
爲了讓您放心,現在是5年後,最新版本的XCode仍然無法用這個錯誤失敗。至少蘋果是一致的... http://stackoverflow.com/questions/3912532/ios-how-can-i-receive-http-401-instead-of-1012-nsurlerrorusercancelledauthenti/29341651#29341651 – 2015-06-22 12:53:53