It is possible I believe as I am doing it currently, here's my code, the trick is to set the header for "Authorization" with "Basic base64encodedmethod(username:password)"
//SETUP URL
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://YOURURLHERE"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:90.0];
//Get the username & password - then encode the values with Base64 (i googled for a library)
NSString *userAndPassword = [NSString stringWithFormat:@"%@:%@",userName,password];
NSString *encodedString = [userAndPassword base64EncodedString];
//Set the Authorization header which will now let your service calls pass basic authentication
[request addValue:[NSString stringWithFormat:@"Basic %@",encodedString] forHTTPHeaderField:@"Authorization"];
//Setup a queue and call the async request - remember to do items in your block on the
//main thread if it's for things like showing/hiding items as other threads will not run that code when you're expecting it
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
//your code block here
}];
I believe that answers your question, now I just need to find out how to delete that authentication so I can log the user out as I'm building this for a secure legal site. Any help there would be appreciated