我正在使用一个使用 HTTP 基本身份验证和NSURLConnection. 在我的NSURLConnectionDelegate, 中,我实现了–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:],
–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]和
–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:],但没有一个被调用。
我已经尝试实现–[NSURLConnectionDelegate connectionShouldUseCredentialStorage:]同时返回YESand NO,但这没有效果。
我还确保 myNSURLCredentialStorage是空的。
最后,我没有实现–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:]、
–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]和
–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:],而是实现–[NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge:]了 ,但也没有调用它。
我可以做些什么来进行NSURLConnectioncallNSURLConnectionDelegate的身份验证回调?