Ionic Storage: iOS does not work

Hello,

any storage functions does not work on IOS. (Android & Browser: no problem).

constructor(public navCtrl: NavController, public navParams: NavParams, public http: Http, public storage: Storage, public alertCtrl: AlertController, public loadingCtrl: LoadingController)
	{
		storage.ready().then(() => {
			storage.get('token').then((val) => {
				this.loadEvents();
				console.log(val);
			});
		});
	}

No output in console and my function “loadEvents” will not called.

I’v already removed the storage plugin and installed again.

allready tried to wrap everything in the platform ready event

Hi.

Same problem.

But i found out not problem if storage.get placed in the function and calling with button.

Anyone have an explication ?

yes, no changes :confused:

Could the problem come from right of access? I am in test mode on a physical iPhone, but i don’t receive message for accept local storage ! Normal ? I don’t know.

Thank for you help.

The NativeStorage libs obviously does not have time to load.

The code in the constructor runs before loading the nativeStorege (at least that’s what I think).

Here is my solution:

platform.ready().then( () => {
this.nativeStorage.getItem(‘jobsTimer’).then( val => {
this.jobs = JSON.parse( val );
},
error => {
this.jobs = [];
//console.error(error)
});
} ));

Valid on physical iPhone.