Hello stackoverflow,
So I am trying to create a request that will automatically follow the redirects in its process. For some reason this is not working, this is what my delegate method looks like. Do I need to do anything else for this to function properly? Thanks!
-(NSURLRequest *)connection:(NSURLConnection *)connection
willSendRequest:(NSURLRequest *)request
redirectResponse:(NSURLResponse*)redirectResponse {
NSLog(@"RedirectResponse:%@", [redirectResponse URL]);
NSLog(@"send request:%@", [request URL]);
NSHTTPCookieStorage *cookieDict = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSLog(@"CURRENT COOKIES: %@", [cookieDict cookies]);
/*NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)redirectResponse;
if ([redirectResponse respondsToSelector:@selector(allHeaderFields)]) {
NSDictionary *dictionary = [httpResponse allHeaderFields];
NSLog([dictionary description]);
}*/
NSURLRequest *newRequest=request;
return newRequest;
}