I am learning to create my own web browser for iPhone. I use UIWebView
, and using this article, I can create it easily.
But the problem arises when I had to
Well, this is the first time I answered my own question. It solved rather easily : use this library : ASIHTTPRequest. So I change my code from this :
NSURL *url = [NSURL URLWithString:[addressBar text]];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlRequest];
[addressBar resignFirstResponder];
Into this :
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [[NSURL URLWithString: [urlAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] retain];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setUsername:@""];
[request setPassword:@""];
[request startSynchronous];
It will prompt for username & password if needed.
Thanks