gpt4 book ai didi

objective-c - ASIHTTPRequest 在请求 :willRedirectToUrl: is implemented 时停止下载

转载 作者:行者123 更新时间:2023-12-01 18:31:07 26 4
gpt4 key购买 nike

只要我添加 request:willRedirectToUrl:委托(delegate)中的方法请求停止从重定向的 url 下载,如果我不实现它继续从新 url 下载文件的方法。快把我逼疯了,为什么会这样?

最佳答案

如果您实现委托(delegate) willRedirectToUrl,则委托(delegate)可以完全控制重定向将发生的情况,因此它需要采取必要的措施 - 从 .h:

// Called on the delegate (if implemented) when the request receives a Location header and shouldRedirect is YES
// The delegate can then change the url if needed, and can restart the request by calling [request redirectToURL:], or simply cancel it

所以你只需要打电话:
// Can be called by delegates from inside their willRedirectSelector implementations to restart the request with a new url
- (void)redirectToURL:(NSURL *)newURL;

传递新的URL。

关于objective-c - ASIHTTPRequest 在请求 :willRedirectToUrl: is implemented 时停止下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8688919/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com