IOS Offline Caching WebView content - ios

I need to load an url in a WebView and download the whole content of the website (documents, images, css, etc) to be able to work offline.
I built an app 4-5 years ago (targeting iOS 7.0) using this --> http://robnapier.net/offline-uiwebview-nsurlprotocol
Recently I was asked to check if the app still works for the latest iOS versions. I found that most of the classes mentioned in this article are deprecated now (for example: UiWebView or NSURLConnection).
When I run the app now, the caching process starts but it gets stuck at some point while downloading a file.
I've enabled CFNETWORK DIAGNOSTICS and most of the time I get this error: SSL_ERROR_ZERO_RETURN operation failed because the connection was cleanly shut down with a close_notify alert. I've researched a lot without any success.
I'm thinking about rebuilding the whole app using a modern solution, but actually I don't really find anything clear. Probably it is not common to do these kind of apps.
My question is if someone nows a better approach for this. I don't even care if I do it natively on iOS or using some cross-platform technology like Reac-Native or Flutter.
Any suggestions would be very welcome.
Thanks.
EDIT
The web that I have to wrap inside the WebView implements a Service Worker to cache the data. So in a Safari browser, this web works offline.
I would just need to wrap someone this web in an iOS app, I tried SFSafariViewController but still not working.
SFSafariViewController

Deprecated doesn't mean unavailable. There are still plenty of apps using UIWebView and NSURLConnection. Before you go rewriting your app using the latest and greatest, you should understand what the problem is. There's a good tip for debugging the error you're getting in iOS 11.2.1 Xcode 9.2 BoringSSL SSL_ERROR_ZERO_RETURN(6). Short version: set the CFNETWORK_DIAGNOSTICS environment variable so that you get better network debugging information.
Given the age of your code, I'd imagine that Apple's requirement that apps use secure connections starting in iOS 9 might be at least one factor. You should read up on App Transport Security to learn how to update your app to meet those requirements. You'll definitely need to add a key or two to your app's Info.plist file, and you'll probably also want to update your app to use a https URL instead of http. Making these changes will be much easier than rewriting your app, and you need to meet the ATS requirement anyway, so you might as well do that part first.

Related

How to demo your react-native app continuously during development

As the title suggest I need to be able to showcase a react native app continuously during development every other day with a client which is not technical orientated. The alternativs I see is,
* Sharing a git/github repo for them to download and run through Xcode
which is not a possibility.
*Screen record while i run the simulation on my computer and share it
with the client
Both of these options seems subpar and not optimal.
How do I do this in a better way?
I am sorry if this seems like an open ended question and if you have suggestions on how to better formulate this question please provide it.
You can upload the binary to TestFlight, which allows your client to download and use the app instantly.
You can also consider over-the-air update systems like Expo or CodePush which allows you to deliver Javascript-only updates automatically to your clients when they open the app (just like a web app).

PouchDB in a web worker on iOS : is there a viable solution as of today?

The title says it all: we have a Cordova / Ionic 3 app which uses a local PouchDB to enable offline use. The app also uses a web worker to benefit from multithreading and keep the UI smooth, especially because we use d3.js to render some of the views.
What we've tried so far :
web worker in a separate file : we haven't been able to find a PouchDB adapter (in-memory is not an option) that would work properly in UIWebView or WKWebView
web worker as a blob URL : we tried the worker-pouch utility by Nolan Lawson on UIWebView, which actually worked well... Until we realized (after the app was published on the App Store !) that the app would crash on startup on some devices, with a WebCore: Worker: EXC_BAD_ACCESS error which seems to be related to the webkit method WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDB. This happens on iPhones or iPads, running iOS 10.x or 11.x.
We've spent quite a few days trying to find our best option here, and while we've found many reports about the situation in 2016 (kudos to Mr Lawson), we cannot seem to find a viable option as of today.
Has any of you had a successfull experience (s)he'd like to share ? (WKWebView ideally, but UIWebView would also do :)
Cheers

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

URL schema for launching Notes app in iOS

Is there a URL schema for launching the built in Notes app in iOS 6? I have seen significantly more work than what is provided here:
https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html
Specifically, the entire settings app seems to have URL schemas for each page.
The sad fact is that if Apple does not publish a means to do it, any hack will surely break in the future. It use to be possible with a hack to open Settings, but then one day it stopped working.
The best thing to do is enter a bug report at bug reporter.apple.com and request this feature - that said apple won't do it unless they get lots of such requests.

Submitting webapp launcher to Apple Store

I have never developed for iPhone, but I have developed an HTML5 web application.
I would like to submit to the Apple store a free app whose job would be to just open up the HTML5 webapp in the mobile browser.
Do you think it will be likely that such an app can be accepted? Can you please provide links or evidence?
Is it possible to ask this question to the Apple team so that I am not going to waste $99? If so, how?
If your app has native web views pulling internal HTML5 information, you might be able to sneak it by some of the app reviewers, but a good portion will say that there is not enough native Apple code in the app. They are sticklers for that.
I have, on a few occasions, gotten away with adding push notification, saying it HAS to be an app, and can't rely on users going to the website since they need push (even though I never intended on pushing anything out), but Apple has caught on to this.
Ultimately, you need to use Apple code in xCode, and you need to use a lot of it.

Resources