iOS UIWebView and Cookies storage - ios

I use Cordova 4, Angular 1.4 and Ionic 1.3 to make a tablet app for Android and iOS.
When user synchronised datas, app opened another window (cordova-plugin-inappbrowser) and displayed our SSO webpage. When user ended to connect, window was closed and synchronisation was send again.
Android store session cookie when app is closed but iOS don't.
Each time user open app on iOS, he need to open window authentificator.
Is it a way to store much longer cookies on iOS ?
Thanks

EVURLCache may help you.
This is a NSURLCache subclass for handeling all web requests that use
NSURLRequest. (This includes UIWebView)
The EVURLCache is meant for handeling the following caching
strategies:
The app has to be functional even if there is no internet connection.
The app has to be functional right after the app has been downloaden
from the app store. (This means that the required content can be
included in the app.)
You do want to be a able to download new/updated
content if it's available.
Note:
Support: iOS 8+ OSX 10.9+ WOS 2+ TVOS 9+

Related

Firebase Dynamic links behaviour on iOS 8 vs. iOS 10

I have an app already on App Store that has a custom URL scheme registered.
I implemented Firebase Dynamic Links for the new version of the app.
When testing the new links, when I open a FDL with the old App installed on iOS 10, I get redirected to the App Store to update the app.
When I open a FDL with the old App installed on iOS 8, the old app is opened because openUrl for my URL scheme is triggered. My app crashes because of this, because the old app is unable to handle such link.
I expected that on iOS 8 it would also redirect me to the App Store to update the App as it does on iOS 10.
Even sending imv=min_app_version (as described here) as a part of the FDL does not help.
Why is this behavior different between iOS 8 and 10? Is there any way how to stop this happening on iOS 8?
Thank you.
iOS 8 does support custom URL schemes pretty well, also iOS 8 does not supports Universal Links. Because of these reasons Firebase Dynamic Links will use custom URL scheme to detect that your App is installed/not-installed on iOS 8 (and open the App).
iOS 9 and above do not have nice support for custom URL schemes and these OS's have Universal Links. Firebase Dynamic Links will use Universal links there.
About imv: we do provide imv parameter, but contrary to Android, we do not know version of the installed iOS App. We expect App to handle imv. For example if App that opened the link have lover version number than specified in imv, App should show message to the user and redirect to AppStore for upgrade.
One way how you can resolve this situation is to create new custom URL scheme that does not exists in your already released App versions. In this way older Apps, that crashing, will not be opened by Firebase Dynamic Links.

View set cookies of an iOS app?

I am trying to debug an iOS app without having the actual code.
It is using a ui web view, calling a website that sets cookies. I need to check which cookies are set. The problem does not appear in safari, only in the app, so I need to check the cookies of the app.
How can I do that? Is there a developer tool that can help me read the cookies similar to the safari web inspector?
Or do the developers have to use a certain framework to make the cookies readable?
Can I use xcode to debug an app - similar web inspector for safari - without having the code?
Thanks in advance for any hints.
This is kind of an old question but nevertheless relevant. So for the sake of posterity here's is how to connect an iOS mobile device to an OSX device to view web inspector.
https://appletoolbox.com/use-web-inspector-debug-mobile-safari/

when my app is not intalled, iOS universal link in UIWebView will launch Safari?

From Apple's guide in Support Universal Links:
When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
But i'm confused that if my app is not installed,and I tap a universal link of my app in another app's UIWebView,will the system launch Safari app to load my website,or still load it in the UIWebView?
I test some app's universal links when the app is not installed,and they never launch Safari to load the next page ,they still load it in the UIWebView.
I want to konw if it's possible to launch Safari,but not stay in UIWebView.Do I need any configuration in apple-app-site-association file?
Actually I want to trace where my app was installed from by using cookie.I can store a cookie in Safari with informations of the download page,and get the cookie with SFSafariViewController when my app is installed and opened,and present different views according to the cookie.
What you are trying to build is called 'deferred deep linking'. This (plus a lot more) is exactly what we provide at Branch.io. If you want to avoid the headache of configuring it all yourself, give this a look. Apps like Pinterest, Airbnb, and Tinder all use us for this reason.
Apple's documentation is referring to the default behavior with the standalone Safari browser. Handling links inside an app with UIWebView supersedes this, and there is no way to automatically bounce out of the origin app into the main Safari app.
The workaround is to store data on your own backend. As you've discovered, relying on a cookie pass-through on the device itself won't work in many cases.

How To: Home Screen Apps and offline usage on ios 6 – cache manifest obsolete?

Since apple's ios update to ios 6 data/local storage for Web Apps and Home Screen Apps is handled differently than before. Before ios 6 they shared the same data. Now home screen apps have their own data like native apps (see here: iO6 and Data Storage).
Since I have some trouble with the cache manifest in my home screen app (works fine in mobile safari, doesn't work right in home screen app – see here: strange behaviour with cache.manifest / offline usage of web app saved to home-screen on ipad ios6), I asked myself if it might no longer be necessary to store data for offline usage for home screen apps via the cache manifest. I searched the web without any luck.
So my question is following: is the cache manifest obsolete for home screen apps on ios 6? And if so, can I just leave it in there or do I have to remove it? Or: do I need to initiate offline storage somehow different now?
As I uderstand it the cache manifest was/is used to tell what data for a website should be cached so later visits would have decreased loading time AND the website could be used offline (either in mobile safari or as a home screen app). But if now the home screen app and the original website do not share the same data anymore – how is caching for home screen apps handled now?
I would be very happy for any advice/help on this. Or at least some links for some how-tos.
Thx!
You still need the manifest file just like before. In fact you should not change anything, your web app should work just like before.
The only difference is that now home screen web apps have their offline cached (and local storage) stored separately from web apps in the safari.
Before there was only one place. So, before, if you had your app open in safari and also as home screen web app, they will both share the same offline cache and localstorage.
Now, each has its own cache separate from the other.

Do iPhone Offline Web Apps and Safari share the same HTML5 Application Cache?

I have a web app that is intended for use as an iOS offline web app. A key feature of the app is that users can download files with extensions like .doc, .ppt, .pdf, etc. To make these available offline, I am making entries for any such files in a cache manifest.
One other caveat: the most user-friendly way I could get these files to open is to jump out of the offline web app and into Safari to actually open the file. This way, I get the "Open in {{Application}}" options that Safari provides. There seems to be some sort of disconnect during this switch from the offline web app to Safari.
Assuming a clean slate:
I've gone and wiped all the data for this site using Settings->Safari->Advanced.
I launch the offline web app while connected to the server (So we're in online mode.)
The application updates the cache successfully.
I close the web app and disconnect from the server.
I relaunch the app and all of the navigation chrome works, so we know the cache is functioning properly.
I click the link to open a file that needs Safari, so iOS switches to Safari and goes to the file's URL.
Safari says "Safari cannot open the page because the server cannot be found."
So, it seems the this application cache is accessible from the offline web app, but not Safari? Can anyone verify this?
And then going forward, if that is in fact the case: any ideas for a better way to do it? Thanks!
iOS Safari work same as Safari does. But I assumed that your iOS Safari doesn't load successfully, you know, the network of iPhone isn't fast as your PC. You must attach handlers to determine when your offline data is loaded successfully.
Check it out: http://www.html5rocks.com/en/tutorials/appcache/beginner/ and try to use JS to check status of ApplicationCache.

Resources