Alternative for IndexedDB in IoS app

Hi,

My anvil app was published in AppStore via Appilix, and I have now learnt the hard way that IndexedDB is not (or not consistently) supported on IoS. The data I am storing is too large for localstorage.

Has anyone found a solution to this already?

Cheers,
Stein

I use IndexedDB for an Anvil app that primarily has IOS users needing offline access and things seem to work fine with it (of course, this depends a lot on which IOS version they are using). Only issue is that there is a storage limit of about 1GB which seems fine for my use case.

Another thing you can do is to build your own native app that shows your anvil app in a webview. Then you can do communications between your native and anvil app (and let the native app handle storing of data).

It’s more work than a converter but you’ll have more control of the app. Here’s an example I did with react-native

Thanks for sharing, @divyeshlakhotia!

The app works correctly for iOS users when opened in Safari. The issue appears when Appilix wraps it using WKWebView, which does not consistently expose IndexedDB. So far, I’ve found that IndexedDB fails on an iPhone 13 but works on an iPhone 16.

My plan is to detect when IndexedDB is unavailable and monitor how often it occurs. If it becomes a significant problem, I may need to fall back to the deprecated WebSQL API, which is still supported on iOS.

I’m hoping to avoid having to build a fully native app.

You won’t have to build a fully native app. You just need to use a native library (like SQLite) for storage.

Similarly to how you communicate with js and Anvil, you can do communications between your Anvil app and native app.

The native app will receive the data and handle storing of it. The rest of the Anvil app works normally.

You can even write logic for detecting which platform the app is on and use indexed DB for web and a native storage option for the app

Also, you can try other converters too. There’s hundreds of them out there. Maybe try https://www.pwabuilder.com/

I will have to see over time how big of a problem this turns out to be. If it is a big problem, the native path or different converters will be something to check out. Thanks!