Storage on iOS device doesn't work properly


#1

Hello fellow Ionic developer!

I have a weird problem regarding the Storage in my app. I am using the native Storage provided by Ionic.

import { Storage, IonicStorageModule } from '@ionic/storage';

Basically my boss told me after testing the app on his iPhone (newest iOS 10 version) that the login information he enters is not saved in the Storage, thus after exiting and restarting the app the automatical login function doesn’t work.
The weird thing about this is, that on my Android device (and others) and in the Browser (development) the storage is working just fine. I’m confused about this issue, since I have no idea what would cause it, especially since it works perfect on said devices.

Originally I used SQLite as the driver for it, tried changing it back to choose it’s own, didn’t do anything.

A few words on how I implement the Storage:
I have a service provider for the Storage, which gets initialized during the app start in app.component.ts, basically in the constructor I have a storage.ready().then() block inside the platform.ready() one. That should make sure it’s ready before doing something else.

Afterwards I navigate to the Login Page, and in the ionViewWillLoad() I use the load() function of my provider, which basically loads in all the keys into an object and then proceeds to another function in the Login Page which checks if an URL to the needed API is set, if that is the case it will do some API calls and tries to auto-login.

So yea, does anyone have any idea what the cause could be for iOS to simply not store the data properly? I’d be very thankful.


#2

You could try http://ionicframework.com/docs/native/native-storage/

I had similar issues with the standard storage when using iOS


#3

Hi Duke

Did you find any solution for this?, I have run into the same problem, even by using the native storage, works well for Android but sadly not for IOS. It would be really helpful if you could share your solution if you have found any.

Thank you.