简体   繁体   English

可以使用本机代码中的react-native中的AsyncStorage.setItem()持久保存数据吗?

[英]Can data persisted using AsyncStorage.setItem() in react-native be acquired from the native code?

If I store a piece of information using AsyncStorage in react-native, can that value be got from native code in Java for Android and Objective-C on iOS? 如果我在react-native中使用AsyncStorage存储一条信息,那么该值是否可以从Android for Java中的本机代码和iOS上的Objective-C获得? For example, if I do the following. 例如,如果我执行以下操作。

AsyncStorage.setItem('foo', 'bar');

Can this value be gotten from the Java/Objective-C code in a reliable manner? 这个值能否以可靠的方式从Java / Objective-C代码中获取?

It's possible, see the document. 有可能,请参阅文档。 asyncstorage asyncstorage

The only thing you should do is to confirm the path and key. 你唯一应该做的就是确认路径和密钥。 But we don't do it, instead write code in two platform with same interface 但我们不这样做,而是在具有相同接口的两个平台中编写代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM