TheCocoaProject / cordova-plugin-nativestorage

Cordova plugin: Native storage of variables in Android, iOS and Windows
http://thecocoaproject.github.io/
Apache License 2.0
292 stars 106 forks source link

Undefined data in iOS when trying to store data #145

Open sts-ryan-holton opened 5 years ago

sts-ryan-holton commented 5 years ago

I've installed the latest version of this plugin into my Cordova / Nuxt JS project. I'm trying to store some data when I click a button, and alert the data back when a different button is clicked:

<template>
  <div class="fill-height has-safe-area-top">
    <v-container>
      <v-layout row pb-2>
        <v-flex>
          <h1>Native storage test</h1>
          <v-btn @click="storeData">Store</v-btn>
          <v-btn @click="getData">Get</v-btn>
        </v-flex>
      </v-layout>
    </v-container>
  </div>
</template>

<script>
export default {
  methods: {

    storeData() {
      NativeStorage.initWithSuiteName("suitename");
      NativeStorage.setItem("reference_to_value", "my value");
    },

    getData() {
      alert(NativeStorage.getItem("reference_to_value"))
    }

  }
}
</script>

This seems to return undefined on the alert() when testing on a physical device compiled in Xcode 10.