user1439284
user1439284

Reputation: 21

Allow trusted SSL Certificate in iPhone

I know how to implement "https" using NSURLConnection for async requests. It can be achieved using a couple of delegate methods. Now my problem is , I have my entire app working using sync request and it is impossible to change it into async at this point. Could anyone please tell me how to implement SSL Verification for synchronous request in NSURLConnection?

Upvotes: 2

Views: 535

Answers (1)

daltoniam
daltoniam

Reputation: 579

I have never found a way to. NSURLConnection sync request are extremely limited in functionality. I wrote a wrapper around NSURLConnection I call GPHTTPRequest. Should allow you do to sync request with the ability to allow self-signed and works a lot like ASIHTTPRequest, but is based on NSURLConnection instead of being the lower level CFNetwork framework. link is here:

https://github.com/daltoniam/GPHTTPRequest

also quick code example:

GPHTTPRequest* request = [GPHTTPRequest requestWithString:@"https://selfsignedURLYouwanttoaccess"];
request.allowSelfSigned = YES;
[request startSync];
NSLog(@"response: %@",[request responseString]);

also for the sake of options you can check out:

http://allseeing-i.com/ASIHTTPRequest/

https://github.com/afnetworking/afnetworking

but I would recommend GPHTTPRequest just because I wrote it and know how it works. ;) Any questions let me know.

Upvotes: 1

Related Questions