Thursday, May 24, 2012

Server API change from HTTP to HTTPS

Doing an iOS client for business service, where client communicates with server to read and update certain undisclosured business data. Current development API is using HTTP with dummy test data, but real service will use HTTPS once everything has been validated to be safe and secure.

Client connectivity change from HTTP to HTTPS was done basically by adding (only) this code:

#pragma mark - NSURLConnectionDelegate callbacks

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *) connection
{
    return YES;
}

- (void)connection:(NSURLConnection *) connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    [[challenge sender] useCredential:[challenge proposedCredential] forAuthenticationChallenge:challenge];
}


Still surprised it was so easy, but not really complaining! Fingers crossed (and testing again and again well before deadline)!

No comments:

Post a Comment