didReceiveAuthenticationChallenge没有被调用

ans*_*hul 6 ios5

我使用的是iOS sdk5.0.我正在使用NSURLConnection打一个链接并创建一个请求.但我的控制不是进入didReceiveAuthenticationChallenge方法.在iOS5.0中没有调用didReceiveAuthenticationChallenge吗?

Him*_*dav 14

根据文档NSURLConnectionDelegate

connection:canAuthenticateAgainstProtectionSpace:
connection:didReciveAuthenticationChallenge:
connection:didCancelAuthenticationChallenge:
Run Code Online (Sandbox Code Playgroud)

不推荐使用,新代码应该采用

connection:willSendRequestForAuthenticationChallenge
Run Code Online (Sandbox Code Playgroud)

旧代表仍将被要求兼容性,但在处理身份验证挑战时会产生更多延迟.