从本机代码访问AsyncStorage [英] Access AsyncStorage from native code

查看:186
本文介绍了从本机代码访问AsyncStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用JS代码中的AsyncStorage将数据保存在本地存储中。

I need to persist data in local storage using AsyncStorage from JS code.

我想知道是否有办法从本机访问AsyncStorage存储的数据代码(Objective-C或Java)。

I would like to know if there is a way to access data stored from AsyncStorage from native code (Objective-C or Java).

谢谢!

推荐答案

如果导入 RCTAsyncLocalStorage.h ,则可以调用 _getValueForKey https://github.com/facebook/react-native/blob/master/React/Modules/ RCTAsyncLocalStorage.m#L266

If you import RCTAsyncLocalStorage.h, you can call _getValueForKey: https://github.com/facebook/react-native/blob/master/React/Modules/RCTAsyncLocalStorage.m#L266

这篇关于从本机代码访问AsyncStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆