【问题标题】:RNEncryptedStorage is undefined in react-native-webRNEncryptedStorage 在 react-native-web 中未定义
【发布时间】:2023-02-20 03:06:23
【问题描述】:

我正在开发 ios 和 web 应用程序。为了使用加密存储来存储凭据,在网络中我现在使用本地存储。 但是在编译网络应用程序时会抛出错误。

rnw_blogpost.bundle.js:5540 Uncaught Error: RNEncryptedStorage is
undefined at eval (EncryptedStorage.js:1:862) at
Object../node_modules/react-native-encrypted-storage/lib/module/EncryptedStorage.js (rnw_blogpost.bundle.js:1766:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (index.js:1:389) at
Object../node_modules/react-native-encrypted-storage/lib/module/index.js
(rnw_blogpost.bundle.js:1776:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (encrypted-storage.ts:1:565)
at Object../src/util/encrypted-storage.ts
(rnw_blogpost.bundle.js:4098:1)

这是由于https://github.com/emeraldsanto/react-native-encrypted-storage/blob/master/src/EncryptedStorage.ts#L7

有什么办法,在网络上我可以处理它。

【问题讨论】:

    标签: ios react-native react-native-web


    【解决方案1】:

    在我看来这可能是一个钥匙串权限问题——源代码中的错误没有显示什么正在发生,但看起来系统根本无法导入RNEncryptedStorage。另一种可能性是它可能只是缺少依赖项——你试过pod install了吗?

    【讨论】:

    • 是的,我已经完成了 pod install。事实上,它在 IOS 中运行良好,但相同的代码正在网络上运行。由于在网络中 RNEncryptedStorage 不存在,它会在编译时抛出错误。
    • 你在 Safari 中测试吗?
    • 没有铬。我正在使用 react-native-web 在网络浏览器中运行相同的代码库。
    • 可能是那时。试试 Safari?
    【解决方案2】:

    关于这个的任何解决方案?我有同样的问题

    【讨论】:

      猜你喜欢
      • 2021-08-27
      • 1970-01-01
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      • 2016-11-23
      • 1970-01-01
      • 1970-01-01
      • 2021-09-15
      相关资源
      最近更新 更多