AFNetworking 2.0: NSURLSessionDownloadTask is cancelled when received 302 to AWS S3

断了今生、忘了曾经 提交于 2019-12-04 13:11:11

I was having the same problem with S3 and seem to have resolved it. AFNetworking was returning a value in the authentication challenge handling logic that was canceling the request.

By telling the AFURLSessionManager how to handle authentication challenges I've fixed the problem.

[manager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition (NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential) {
    return NSURLSessionAuthChallengePerformDefaultHandling;
}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!