I have an app created in ionic-v3 that when after login uses preferences stored in storage to load data and if no preferences are set the user gets prompted to set these and they’ll get stored. I have however gotten some complaints from users that they need to set these preferences almost every time but sometimes it can go a couple of days before the storage is cleared again.
I couldnt recreate this issue on devices with version 13.x but when upgrading one of my devices to 14.3 i’m starting to experience the same issues as the users, when checking the logs in xcode while running the app i cannot see anything out of the ordinary and there’s a seemingly randomness to the bug its hard to pinpoint the issue other than this version of IOS are having problems with persisting storage in browser.
Anyone else on Ionic v3 experiencing these kinds of issues with the latest IOS version?
If you are running web only app, then you may be suffering from the fact that local storage in iOS is not guaranteed to persist. iOS policy is to clean whenever it feels like it… I think this is something at least reported many times in the past.
Maybe setting the storage driver (if you use Ionic Storage) to async may help a bit…
If you run with cordova storage and sqlite, then I don’t know.
So it looks like I have the right order on android atleast (its not specified in app.module). However I dont have access to a iphone or mac so i cannot check the config on IOS right now. But maybe i should add driverOrder to the IonicStorageModule.forRoot() anyway as a precaution?
console.log(this.platform.driver) will tell you what is actually used. The system will fall back on the driver order - giving headaches as well. The config itself may be too little info to debug?
In Android you can use ADB to trace other messages, at native level. iOS has similar thing?
Horror bugs like these may require also remote logging, where you log usage by uploading realtime console.logs. For instance, upload the driver used, store a value and retrieve it, and show the results. Etc. Maybe be a bit overkill, but at least you can start figuring out patterns.
That is true, i used the response from the storage class ready() method, tried again with the storage.driver but luckily it was the same “cordovaSQLiteDriver”.
Im not sure what ADB is but i use the chrome://inspect/#devices to read the logs, not sure if there’s something similiar in Xcode maybe?
However your comment gave me one idea, when i check if there is a value stored i dont check if storage is ready so maybe its trying to get a value before the cordovaplugin is initiated which then would maybe fallback to another driver ? Or does it work like that? Or will it wait for the plugin to become ready? The get-method is in form of a promise so maybe it does wait.
Yes, worst case scenario i will have to do live logging, hopefully its a last resort i dont have to visit.
But i appreciate all the help man now i have some new things to try. Will head to the office tomorrow and get a hold of a mac and iphone.
if u use cordova, you HAVE to wait until cordova is ready
Besides waiting until storage is ready
ADB is low level debugging monitor. Basically looking at the android syslogs etc on the device.
It will give you a dumpload of entries, and in between you will be able see potentially erorrs and warnings
I would be very surprised if waiting on storage wasn’t sufficient, and a cursory glance at the source would seem to back that up: the _dbPromise inside Ionic Storage bubbles up the return value of localForage’s setDriver call.
This would explain past issues i’ve had with storing the preferences, will wrap it in a platform.ready and storage.ready check, thank you. As for checking what driver is used on IOS i finally was able to check on an Ipad and i get asyncStorage when running via XCode and checking the logs via Safari, if i try and add
Not a bad idea, will try and do that! Again thanks and have a good weekend!
Update for future references: I removed cordova-sqlite-storage plugin and reinstalled it aswell as doing an npm install. I rebuilt the project again and the cordovaSQLite driver was recognised as the driver to use, hopefully this will resolve the issue but only time can tell. I didnt know which answer from Tommertom to mark as the solution as each respons got me a little closer to identifying the faulty plugin and fixing it so but hopefully his/her latest respons will suffice.