Hi,
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.
Thanks,
Steve
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:
data: {
username: loginData.username,
password: loginData.password,
action: "login",
view: "console"
}
})
.success(function (data, status, headers) {
// console.log(">>>>>>>>>>>>>> PARALLEL POST SUCCESS");
$ionicLoading.hide();
// Coming here does not mean success
// it could also be a bad login, but
// ZM returns you to login.php and returns 200 OK
// so we will check if the data has
// <title>ZM - Login</title> -- it it does then its the login page
if (data.indexOf(zm.loginScreenString) == -1) {
//eventServer.start();
$rootScope.loggedIntoZm = 1;
Thanks so much, I’ll soon switch to localForage.