简体   繁体   English

在iPhone上存储数据的最佳方法是什么?

[英]What's the best way to store data on iPhone?

i have made iOS apps using SQLite Database... 我已经使用SQLite数据库制作了iOS应用...

For this I read the guideline from Apple and found that "user can store files in the /Documents directory" 为此,我阅读了Apple的指南,发现“用户可以将文件存储在/ Documents目录中”

In my application, I am using single mode login. 在我的应用程序中,我正在使用单模式登录。 For this I am storing all user data (which are basically Sqlite db) to Documents directory. 为此,我将所有用户数据(基本上是Sqlite db)存储到Documents目录中。 The Database is also present in the same directory which contains the details about the downloaded from web. 该数据库也位于同一目录中,该目录包含有关从Web下载的详细信息。

My question is,
1. Should I have to change the storing file location instead of to the Documents directory?
2. Where should my database file be placed?
3. don't want to delete database file after user deleting Apps.(if user installed again i want to show that same db)

If I put it Documents directory once user deleting apps from device it's removed all files. 如果我在用户从设备删除应用程序后将其放置在Documents目录中,则会删除所有文件。

Kindly guide me on this issue. 请在这个问题上指导我。 Thanks in advance. 提前致谢。

  1. & 2.: Using The documents directory is fine. &2 .:使用documents目录很好。
  2. You can't retain data after an app is deleted. 删除应用后,您将无法保留数据。 A better way to do this would be to have user accounts where a copy of a person's database is stored on a server. 更好的方法是拥有用户帐户,在此帐户中存储一个人的数据库的副本。 The user would just login and download their account info if they ever reinstalled. 如果用户重新安装,则只需登录并下载其帐户信息。 (see Parse.com for some awesome ways to do this). (请参阅Parse.com,以获得一些很棒的方法)。

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

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