我们使用NSURLSessionDataDelegate并实现了以下委托方法:
- (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler { ... }
我们经常发现 iCloud 用户会遇到NSURLAuthenticationMethodXMobileMeAuthToken挑战。发回拒绝不起作用(因为服务器不会尝试另一个挑战)并发回接受
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
也不行。
我们应该如何处理这种身份验证质询类型?有其他人看过吗?