PDA

View Full Version : didReceiveAuthenticationChallenge: method is not getting called.




coramoor
Apr 23, 2009, 01:35 AM
Hi.
I've been looking for a solution to log into my account, on say YouTube (I've tried many other different web-sites that require a login), through my iPhone application. Here is the code I am trying to use to do so:


static NSString *url = @"http://www.youtube.com";

// create the request
NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];

// create the connection with the request
// and start loading the data
NSURLConnection *connection=[[NSURLConnection alloc] initWithRequest:request
delegate:self
startImmediately:YES];
if (connection) {
// Create the NSMutableData that will hold
// the received data
// receivedData is declared as a method instance elsewhere
receivedData=[[NSMutableData data] retain];
} else {
// inform the user that the download could not be made
}



[myWebView loadRequest:request];


I've implemented all the delegate methods for this request and connection, and all of them except for didReceiveAuthenticationChallenge get called. From what I understand this method does not get called only with synchronous connection.

I thought that the page I am loading does not through authenticating challenges and that would be the reason for this, but I tried changing the URL directly to the login pages (on different sites) and the result does not change. What is the problem?

Thanks.


EDIT: The response code I am getting is 200.