PhoneGap localStorage 是否保存到 iCloud?

发布于 2024-12-11 02:21:14 字数 92 浏览 0 评论 0原文

如果我在 PhoneGap 中制作一个使用 localStorage 来存储键/值数据的应用程序,这些数据是否会通过 iCloud 同步到其他设备?我不需要保存太多数据。

If I make an app in PhoneGap that uses localStorage to store key/value data, will this data be synched to other devices via iCloud? I don't need to save much data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小姐丶请自重 2024-12-18 02:21:14

我不同意@sciritai。

iOS 中的 localStorage 只是一个存储在设备上某处的 SQLite 数据库文件。

也许以前的 Phonegap/Cordova 版本中的情况有所不同,但在当前版本中,Phonegap 将 localStorage.db 文件写入应用程序的 Documents 目录中。

具体来说: Documents/Backups/localstorage.appdata.db

由于 Documents 目录是针对每个应用程序的,因此它会自动保存到 iCloud。

当我检查 iOS 中的 iCloud 设置(在存储和备份 > 管理存储下)时,我可以确认这一点。

我可以看到我的 HTML5 iOS 应用程序正在备份到 iCloud。这包括 localStorage 中的数据:)

我相信这意味着如果您有多个设备,则 localStorage 将在它们之间同步 - 尽管我自己还没有证实这一点。我不确定 iOS 实际上如何处理 localStorage 文件中的冲突。

I disagree with @sciritai.

localStorage in iOS is just an SQLite db file that is stored somewhere on the device.

Perhaps things were different in a previous Phonegap/Cordova version, but in the current version Phonegap writes the localStorage.db file into the Documents directory for your app.

Specifically: Documents/Backups/localstorage.appdata.db

Since the Documents directory is specific for each app, it will be automatically saved to iCloud.

I can confirm this when I check out the iCloud settings in iOS (under Storage & Backup > Manage Storage).

I can see that my HTML5 iOS app is being backed up to iCloud. And that includes the data in the localStorage :)

I believe that means if you have multiple devices, that the localStorage would be synced between them - although I have not confirmed that myself. I'm not sure how iOS would deal with conflicts in the localStorage file actually.

一页 2024-12-18 02:21:14

我和@asgeo1 一起讨论这个问题。我刚刚提交的一个phonegap应用程序被苹果拒绝了,因为它大量使用了临时文件的本地存储,并且这些文件被输入到icloud上的备份中。

解决方法是将其添加到您的 config.xml 中:

<preference name="BackupWebStorage" value="none" />

I'm with @asgeo1 on this on this one. An phonegap app I just submitted has been rejected by apple because it makes heavy usage of local storage of temporary files and these were being entered into backups on icloud.

The fix is to add this to your config.xml:

<preference name="BackupWebStorage" value="none" />
反差帅 2024-12-18 02:21:14

正如 asgeo1 所说,localstorage 确实会保存到 iCloud。您可以通过在 config.xml 中将 BackupWebStorage 设置为 none 来关闭此功能。 此处是 Phonegap 文档的链接。

请注意,只有用户数据可以存储到 iCloud。离线用途所需的数据可能不会存储在 iCloud 中。 此处是 Apple 问答的链接。

Just like asgeo1 says, localstorage does get saved to the iCloud. You can turn this off by setting BackupWebStorage to none in the config.xml. Here is a link to the Phonegap documentation.

Note that only user data may be stored to the iCloud. Data that is needed for offline purposes may not be stored in the iCloud. Here is a link to Apple's Q&A.

屋顶上的小猫咪 2024-12-18 02:21:14

不,localStorage 是基于浏览器的,并通过 Phonegap 为您提供的 UIWebView 持续存在,它不与应用程序绑定。

您可以编写一个插件来访问文档目录以将信息保存到iCloud 与 Phonegap。

这里是旧的不正确信息。请参阅下面@asgeo1 的回答。

No, localStorage is browser based and persists through the UIWebView that Phonegap gives you to play in, it's not tied to an app.

You can write a plugin to access the documents directory to save information to iCloud with Phonegap.

Old incorrect information here. See @asgeo1's answer below.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文