LocalStorage is empty at app launch on ios 10


I’ve 2 apps that was running perfectly well until I upgrade my phone to iOS 10.

I use LocalStorage to save an api access_token to log automatically the next time.

But this doesn’t work anymore on iOS 10.

I test it and my access_token get successfully save while the app is running but if I close and re-open the app, there is no LocalStorage values.

Is it an iOS bug, or a security things?

Does someone else have this issue?

What can be my alternative? I want something simple, don’t want to rely on sqlite just for one value.



Don’t use local storage for persistent storage. IOS clears it when its disk or memory is full. I’ve also noticed IOS 10 is far more aggressive in clearing it.
Switch to localforage with SQLite. It abstracts the interface so it looks like a localStorage call but is async.

You can try indexDb or webSql too via localForage . I’m not sure what the iOS policy is for persistence for them.

Example of how I init and use it:

Thanks so much, I’ll soon switch to localForage.