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:
Showing posts with label https. Show all posts
Showing posts with label https. Show all posts
Thursday, May 24, 2012
Server API change from HTTP to HTTPS
Wednesday, January 5, 2011
How to Debug NSURLConnection HTTP Headers
When you are connected to a server somewhere in internet and something doesn't seem to be quite right, what would you do?
That's right, check HTTP headers from server response:
That's right, check HTTP headers from server response:
Labels:
allHeaderFields,
debug,
didReceiveResponse,
https,
NSHTTPURLResponse,
NSLog,
NSURLConnection,
NSURLResponse
Thursday, July 15, 2010
How to Accept Self-Signed Server Certificate
We have public server, test server and release test server. Likewise I generate three different binaries, each connecting to different server. The problem is that test servers have self-signed certificates and iPhone fails by default in NSURLConnection sendSynchronousRequest. The error note is:
To remove compiler warning add this at the beginning of your file:
iOS5 update: this code might (or maybe not) help a little from my blog article Server API change from HTTP to HTTPS
ERROR CODE -1202 = The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xx.xx.xxx.xxx” which could put your confidential information at risk.The solution with iOS4 is this one line:
#if (defined(TEST_VERSION) || defined(RELEASE_TEST_VERSION))
[NSURLRequest setAllowsAnyHTTPSCertificate:YES
forHost:[url host]];
#endif
[NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&error];
Please note that the specific line is undocumented class method and thus not used in official release, only for testing with simulator or ad hoc releases.To remove compiler warning add this at the beginning of your file:
#if (defined(TEST_VERSION) || defined(RELEASE_TEST_VERSION))
@interface NSURLRequest (DummyInterface)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
+ (void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString*)host;
@end
#endif
More info at Dr. Touch article: Ignoring Certificate Errors on NSUrlRequest.iOS5 update: this code might (or maybe not) help a little from my blog article Server API change from HTTP to HTTPS
Labels:
adhoc,
certificate,
https,
iOS4,
iphone,
NSURLConnection,
NSURLRequest
Subscribe to:
Posts (Atom)
