|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
NSURLConnection Delegate RedirectResponse is always nil
Hi all,
I have this problem that is driving me insane. I am using the WillSendRequest RedirectResponse delegate method of NSURLConnection to find out if I am being redirected. The problem is that it doesn't work properly. RedirectResponse for some reason is always nil, and "request" seems to be the original request instead of the request with the redirect url. Any idea why it is doing this? Please help. Here is the code: Code:
-(NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
{
NSURLRequest *newRequest=request;
NSLog(@"Request: %@",[[request URL] absoluteURL]);
NSLog(@"The Request: %@",[[theRequest URL] absoluteURL]);
if (redirectResponse) {
NSLog(@"redirect requested!");
[connection cancel];
[connection release];
[receivedData release];
[updateController cancelDownloaders];
[updateController alertSimpleAction: @"Could not download file. \n Please check your username and password"];
newRequest=nil;
}
return newRequest;
}
|
|
|
|
0
|
|
|
#2 |
|
Anyone??
I am surprised nobody had this problem before.
I would take any advice about hot to top a connection when the request is being redirected to another page. |
|
|
|
0
|
|
|
#3 |
|
1) Don't bump your posts. It's amazingly rude and arrogant as well as being against the forum rules. So much so that I almost did not post point 2
2) As per the documentation redirectResponse "May be nil in cases where this method is not being sent as a result of involving the delegate in redirect processing."
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
|
|
#4 |
|
Hi,
Regarding point 1, Sorry. I am not sure what you mean by bump up, but I apologize if I caused you any damage of any sort. The last thing i meant was to be arrogant or rude, and again, I am deeply sorry if I broke the forum rules. Thank you for letting me know. Regarding point 2, I read the documentation as well and saw this point, but I guess it was and still is vague to me. And it doesn't solve me the problem. My URLResponse is being redirected to another page, yet the redirect delegate method is being called and the redirect is nil. Why would this method get called if there is no redirect call? I don't understand. |
|
|
|
0
|
|
|
#5 |
|
I think you are misunderstanding what the redirectResponse should/will contain. In the case where you receive a redirect and the delegate has not yet been involved the redirectResponse will be nil (this is my understanding of what the documentation is saying). The request variable is what will be sent (i.e. where you have been redirected to). If you want to alter than you should copy and change it before returning.
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| NSURLConnection, delegate methods dont get called | estupefactika | iPhone/iPad Programming | 21 | Sep 6, 2012 02:47 PM |
| NSURLConnection for multiple views not receiving data asynchronously | ashwinr87 | iPhone/iPad Programming | 13 | Nov 3, 2011 05:47 PM |
| Exchange Delegation Support on iPad in Mail | Supa_Fly | iPad | 9 | Jul 4, 2011 04:11 PM |
| CALayer.bounds - why is it always nil ?? | teek | iPhone/iPad Programming | 3 | Apr 2, 2010 05:13 AM |
| nstableview delegate method is not getting called | hrishidev | Mac Programming | 1 | Nov 24, 2008 05:19 AM |
All times are GMT -5. The time now is 04:46 AM.






Linear Mode

