How to use the UIWebview with enabled cookies? - ios

How to use the UIWebview with enabled cookies? I am using lot of web apps in my iOS app, each app has their own URL to load their app.
All web apps are displayed with their name and app icon in a UITableView (app list). Whenever user tap on app from the app list, we are loading that app in UIWebview.
If user again tap on the same app we are loading from cookies not loading from the start.
In this scenario how to use UIWebview?
Normally UIWebview took lot of memory, if we opened lot of apps memory increased huge.
Please suggest how to use UIWebview with effective manner.

Related

How to use webview or similar control in Watch OS?

Example app: https://itunes.apple.com/us/app/watchup-for-whatsapp/id1320596975
I think this app might load whatsapp webview and parse responses from web and showing in whatsapp app, so any way to make webview or similar control that work in watch app?
EDIT: Can we load webview in iOS app in background and send parsed response to Appel Watch app? is it possible? I don't want to show webview in iPhone app, I just want parsed response and to show it in watch app in tableview app.

WKWebView vs SFSafariViewController

We have WKWebView in iOS 8 and SFSafariViewController in iOS 9.
I know that WKWebView subclasses from UIView, and that SFSafariViewController subclasses from UIViewController.
They are essentially different.
My question is about memory management between these two components.
Quoted from developers at Facebook, Reducing FOOMs in the Facebook iOS app
WKWebView — that actually performs most of its work in a separate process, which means that most web-view-related memory usage would not be attributed to our process.
This helps a lot in preventing our app from being killed because our process consumes a large amount of memory.
Does SFSafariViewController handle web-view-related memory in a separate process like WKWebView?
Yes, Safari View Controller runs in a separate process from your application.
Here's a link to WWDC session.

Performing a task through a website and going back to an iOS app

I'm developing an iOS 7+ app that I need to offer the option of navigating to a certain web page to let the users to fill in a form there, and after that to come back to the app's view where the user was.
Is it possible to programmatically open Safari with a given url? If it is, I suppose that then there is no way to automatically redirect the user to your app from there... right? Is then a UIWebView the only option? Is it possible to navigate back or dismiss the view with the UIWebView without the need of user interaction?
Thanks
You can open links in Safari as detailed in this post How to launch safari and open URL from iOS app
I don't believe you can set a 'callback' and have it return to your app on completion, as you have no control over the user once they have exited your app's sandbox.
Opening the link in UIWebView would provide control, as you can utilize the UIWebView callbacks.

Is it allowed to add a UITabBarItem that opens up Safari?

I want to add a UITabBarItem on the TabBar which when clicked opens up Safari instead of loading its corresponding tab. (Not UIWebView but the app goes to background and opens up Safari instead)
I already know how to do this, but I was wondering if this is allowed by Apple. I know they're OK with using the TabBarItem to trigger other actions such as opening a modal in the app, etc. However I am not sure if it's OK to open a safari.
I am just being cautious because I don't want it to get rejected for this and wait another week.
I don't see a reason why it shouldn't be allowed.
But: it could lead to confusion amongst your users, because they would most likely not expect that touching an item on the TabBar leads to an app switch. I would rather open a webView and offer the additional possibility to open the page in Safari.
There is no harm doing such and it is also allowed by Apple.
But, I would personally suggest to use UIWebView, over Safari navigation. Because it will create unhealthy user experience, where he/she requires to jump around to swith in-between Safari and App. Rather you can open the same link in UIWebView, which will kepp our user in app only.

Locking iPad to Safari and one webpage

Can you somehow lock an iPad to Safari and only one webpage? I've found people locking iPad to certain apps but can't find this anywhere.
One app example:
Lock-down iPhone/iPod/iPad so it can only run one app
From the accepted answer to the question you link to:
It is possible to put an iPad or iPhone into 'Store Demo' mode so that the home button and swipe to home gesture is disabled. If you have seen the iPads in the Apple Store running the smart sign apps then you will know what I mean.
So you could, for example, lock the device to Safari. But then it would be possible to navigate to any webpage.
What you need to do is to write a simple app that has a UIWebView that loads your site, and then put the device in 'Store Demo' mode afterwards. Also, depending on whether your site contains links to the outside world, you may have to implement webView:shouldStartLoadWithRequest:navigationType: from the UIWebViewDelegate protocol so that it refuses to leave your site.

Resources