2011-12-31 1 views
1

デリゲートにrequest:willRedirectToUrl:メソッドを追加すると、リクエストはリダイレクトされたURLからダウンロードを停止します。メソッドを実装しないと、 url。私は夢中になっていますが、どうしてこういうことが起こっていますか?あなたはデリゲートwillRedirectToUrlを実装する場合リクエスト:willRedirectToUrl:が実装されている場合、ASIHTTPRequestはダウンロードを停止します

答えて

4

は、デリゲートは、リダイレクトに何が起こるかの完全な制御を取得しますので、必要な行動を取る必要がある - の.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を渡します。

+0

乾杯!それはとても簡単です! – JonasG

関連する問題