iOS 7 Status bar with Phonegap

I found an answer on another thread, but I’ll answer the question in case someone else wonders. Just replace the viewWillAppear in MainViewController.m with this: – (void)viewWillAppear:(BOOL)animated { // View defaults to full size. If you want to customize the view’s size, or its subviews (e.g. webView), // you can do so here. // Lower … Read more

Getting all cookies from WKWebView

Cookies used (created) by the WKWebView are actually correctly stored in the NSHTTPCookieStorage.sharedHTTPCookieStorage(). The problem is that the WKWebView does not write back the cookies immediately. I think it does this on its own schedule. For example when a WKWebView is closed or maybe periodically. So eventually they do end up in there, but when … Read more

ITMS-90809: Deprecated API Usage — Apple will stop accepting submissions of apps that use UIWebView APIs

Check if you use in your code the UIWebView class; if yes replace your implementation with WKWebView, else need check your Pods. Go with terminal into your project folder and execute the command: grep -r “UIWebView” . All matched pod must be updated. Now I’m stuck because I found UIWebView into Google AdMob (version 7.49.0) … Read more

iOS JavaScript bridge

There are a few libraries, but I didn’t used any of these in big projects, so you might want to try them out: WebViewJavascriptBridge: https://github.com/marcuswestin/WebViewJavascriptBridge GAJavaScript: https://github.com/newyankeecodeshop/GAJavaScript — However, I think it’s something simple enough that you might give it a try yourself. I personally did exactly this when I needed to do that. You … Read more

UIWebView to view self signed websites (No private api, not NSURLConnection) – is it possible?

Finally I got it! What you can do is this: Initiate your request using UIWebView as normal. Then – in webView:shouldStartLoadWithRequest – we reply NO, and instead start an NSURLConnection with the same request. Using NSURLConnection, you can communicate with a self-signed server, as we have the ability to control the authentication through the extra … Read more

How to load local html file into UIWebView

probably it is better to use NSString and load html document as follows: Objective-C NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@”sample” ofType:@”html”]; NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; [webView loadHTMLString:htmlString baseURL: [[NSBundle mainBundle] bundleURL]]; Swift let htmlFile = NSBundle.mainBundle().pathForResource(“fileName”, ofType: “html”) let html = try? String(contentsOfFile: htmlFile!, encoding: NSUTF8StringEncoding) webView.loadHTMLString(html!, baseURL: nil) Swift 3 has … Read more

How to invoke Objective-C method from Javascript and send back data to Javascript in iOS?

There is an API to call JavaScript directly from Objective-C, but you cannot call Objective-C directly from Javascript. How to tell your Objective-C code to do something from the Javascript in your WebView You have to serialize your Javascript action into a special URL and intercept that URL in the UIWebView’s delegate’s shouldStartLoadWithRequest method. – … Read more