I am getting this error
The certificate for this server is invalid. You might be connecting to a server
that is pretending to be \"server addres goes here\"
You've set the delegate as self, so you can fix this by implementing part of NSURLConnectionDelegate in the class sending that request.
Implement this:
-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
By doing this:
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
Note: this is NOT a solution to use in production. Certificates exist for a reason! :)