gpt4 book ai didi

javascript - IOS Safari trim 大量 localStorage 数据、IONIC2 应用程序

转载 作者:行者123 更新时间:2023-12-03 04:57:56 24 4
gpt4 key购买 nike

我目前正在开发 Ionic2 应用程序。我需要在本地存储中存储用户的一些问题。问题 json 约为 70kb(在桌面上保存为 .txt 时)。它在桌面上运行良好。但在 IOS 上查看时,本地存储被 trim ,并没有显示全部值(value)。

Trimmed value of localstorage in ios

您可以看到图像底部的三个点。

有人可以指导我这里出了什么问题吗?我正在使用 localStorage.setItem("question_data",JSON.stringify(data));

最佳答案

请尝试使用ionic的Storage,在Android和iOS上它将使用sqlite而不是localStorage。

Storage is an easy way to store key/value pairs and JSON objects. Storage uses a variety of storage engines underneath, picking the best one available depending on the platform. When running in a native app context, Storage will prioritize using SQLite, as it's one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.

这里是文档:http://ionicframework.com/docs/v2/storage/

关于javascript - IOS Safari trim 大量 localStorage 数据、IONIC2 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42358611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com