3

I'm trying to download a file from google trends. I'm using NSURLConnection to get the file.

I want to let google know I'm logged in (ie authenticate the connection) in order to have no download limit. I tried using:

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

The problem is since the login is not required, the method is never being called. Is there a way I can make sure the connection is authenticated? Thx!

Note: I asked this question before here, but I didn't get a reply so I'm asking again - hope that's ok

EDIT: Maybe I can use - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse ? Can I somehow authenticate through the cache?

Community
  • 1
  • 1

1 Answers1

0

you have to set the correct header fields of the NSURLRequest. Take a look at the answer of this post. You will have to look for base64 encoding too.

Community
  • 1
  • 1
Jonathan Cichon
  • 4,396
  • 16
  • 19