简体   繁体   中英

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

i have made iOS apps using SQLite Database...

For this I read the guideline from Apple and found that "user can store files in the /Documents directory"

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. The Database is also present in the same directory which contains the details about the downloaded from 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.

Kindly guide me on this issue. Thanks in advance.

  1. & 2.: Using The documents directory is fine.
  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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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