Demon Kid
Demon Kid

Reputation:

How to use HTTPS with NSURLConnection?

I'm interested in HTTPS with NSURLConnection. Is it 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?

Upvotes: 0

Views: 4290

Answers (2)

Lounges
Lounges

Reputation: 4664

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

Upvotes: 2

erotsppa
erotsppa

Reputation: 15021

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.

Upvotes: 4

Related Questions