views:

1030

answers:

2

Hi everone,

I'm interested in iPhone HTTPS through NSURLConnection, it's possible to send a request, respond to a challenge and load the secure URL. Is there anything else that can be done with NSURLConnection via HTTPS?

Thank you in advance!

+4  A: 
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://monsite/mapage.php"]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[[NSString stringWithFormat:@"score=222"] dataUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

and then implement the appropiate delegate methods for NSURLConnection.

erotsppa
+1  A: 

NSUrlConnection works out of the box with HTTPS. You do not have to do anything special.

Lounges