How to access ionic native storage in IOS objective C?

actually i am working on an issue i am trying to implement push notifications using a plugin but it only supports ionic for android but i also want it to work with ios for that i have to implement things natively which i have already implemented but i am fetching token from storage in ionic to make it persistent how to fetch it in objective C, i just want to know in case of ios how native storage works for ionic thanks in advance.

Do you mean the ionic torage plugin? That plugin stores it in a sql file or indexed db or localstorage (It tries them in this order and picks the first that works).

On the other hand iOS has its own key-value storage.
Maybe you could make a setup function in your plugin that saves the push token in that kind of storage.

1 Like

i am registering a device in app delegate class and token is received there now what i am doing is i am saving that notification token in nsuserdefaults with a key in objective C now what i want is that i want to access that token in ionic code using ionic native storage plugin which is equivalent to nsuserdefaults in ios but this.nativeStorage.getItem(‘Token’) call could not find that particular token.

and what i heard nsuserdefault is a singleton instance so using it in objective C and Ionic code can be problematic plz help thanks in advance

Just make a function in your plugin to get the information you need and call it in thr ts/js of the ionic part of your application.

By the way I don’t know to which storage plugin you are referring, but if it is the storage plugin from ionic which uses localforage and optionally the cordova sqlite plugin then I can tell you that nsuserdefaults and the storage that is used by this plugins are two completely different things.