What happens, when you rotate iPhone while your application shows embedded webpage with custom background graphics? Hopefully the application rotates, too, and hopefully the background image has been designed well (*).
Here is an example how to top center backgroung image while rotating. Please note that the image has been poorly designed ON PURPOSE. Can't make a point with well designed graphics :)
Showing posts with label NSURLRequest. Show all posts
Showing posts with label NSURLRequest. Show all posts
Friday, March 4, 2011
How to Center Image when Rotating UIWebView
Labels:
html,
loadRequest,
NSBundle,
NSURL,
NSURLRequest,
shouldAutorotateToInterfaceOrientation,
UIViewController,
UIWebView,
viewDidLoad,
webKit
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)
