Currently I am loading an image from URL in my iPhone app, which is working fine. But now i want to access a protected URL. Please guide me with a piece of code that how can i access URL with credentials(username/password).
The simple code through which my app loaded the image from URL is given Below
NSURL *url = [NSURL URLWithString: @"http://www.somedirectory.com"];
UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
[Pic setImage:image];
You can use some third party library like ASIHTTPRequest, which makes it very easy.
Or you can use
NSURLConnectionclass, but authentication implementation is a bit tricky.