Authentication challenge in UIWebView
Hi,
I am developing an app, where i am loading an URL Request in UIWebView.
The request launches a login screen to an online store. On entering the credentials and pressing login button in the login page the HTTP request is converted into an HTTPS request. (i.e) Untrusted certificate error
I have used NSURLConnection delegate methods to handle the authentication challenge.
- (BOOL)webView: (UIWebView *)webView shouldStartLoadWithRequest: (NSURLRequest *)request navigationType: (UIWebViewNavigationType)navigationType;
{
[[NSURLConnection alloc] initWithRequest:request delegate:self];
return YES;
}
- (void)connection: (NSURLConnection *)connection willSendRequestForAuthenticationChallenge: (NSURLAuthenticationChallenge *)challenge
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serve rTrust] forAuthenticationChallenge:challenge];
}
But, still I am not able to launch the home page from the login screen. I am taken to an error handler screen.
Do I have to dod something more to handle this SSL Certificate error ????
Last edited by satya_gs; 12-20-2011 at 04:19 AM.
Reason: removing smileys
|