首页 > 解决方案 > 如果我们在 React Native 中打开控制中心,应用程序会在 iOS 中崩溃

问题描述

我们正在做 React Native 应用程序。它在 iOS 和 Android 上都运行良好。但是,启动应用程序后,如果我们打开控制中心,应用程序就会崩溃。

控制台数据如下

Error: {
    message = "Entries must be arrays of the form [key: string, value: string], got: (\n    InActiveTime\n)";
}

有什么建议吗?

标签: iosreact-nativeecmascript-6crashcontrol-center

解决方案


最后,我找到了问题所在。

问题是我们在 Asyncstorage 中存储了一些键值,我们在那里存储了日期。该日期数据类型无法存储在 Asyncstorage 中。因此,据我了解,我们可以仅存储 Asyncstorage字符串类型。

希望这对将来的人有所帮助。

AsyncStorage.setItem(time, new Date().toString());

推荐阅读