Have such a problem, hope you’ll help me.. Can’t find anywhere. Here is the code i’m using:
NSURL *serverURL = [NSURL URLWithString:@"http://someServer.com/Login"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:serverURL];
[request addValue:@"text/plain" forHTTPHeaderField:@"ACCEPT"];
[request setHTTPMethod:@"POST"];
[request setCachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
NSData *data = [encodedString dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
URLLoader *loader = [URLLoader loaderWithRequest:request];
When I want to acces to the server http://someServer.com/Login from browser on computer all ok.
When I tryied to acces the same server from safary on iPhone simulator – authorization window appears after authorization all was OK.
But when I perform this request in a program way on iPhone simulator, code sample I have posted. Next error appears:
The following error was encountered:
Cache Access Denied.
Sorry, you are not currently allowed to request:
http://someserver.com/Login
from this cache until you have authenticated yourself.
How can I solve this problem?? Thanx!
seems that you need to send the authentication credentials when you make the call.
Try to use
NSURLConnectionclass to make the call, set the delegate and implement the following method