1
只要我在代理中添加request:willRedirectToUrl:
方法,請求將停止從重定向url下載,如果我沒有實現該方法,它會繼續從新的網址。它讓我瘋狂,爲什麼會這樣呢?ASIHTTPRequest在請求時停止下載:willRedirectToUrl:已實現
只要我在代理中添加request:willRedirectToUrl:
方法,請求將停止從重定向url下載,如果我沒有實現該方法,它會繼續從新的網址。它讓我瘋狂,爲什麼會這樣呢?ASIHTTPRequest在請求時停止下載:willRedirectToUrl:已實現
如果實現委託willRedirectToUrl,委託獲得的對重定向會發生什麼的完全控制,因此需要採取必要的行動 - 從.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;
傳遞newURL。
乾杯!它是如此容易! – JonasG 2012-01-01 11:36:19