简体   繁体   中英

What is the best way to store application data on the iPhone?

There are various ways for iPhone applications to save data (for example: NSUserDefault, XML, document, SQLite, etc.).

Our company always uses NSUserDefault to save data. However, I don't think NSUserDefault is very good because in my experience, it has been slow.

I am curious how you store data for your applications and when you recommend using each of the different methods. Please share your experiences that will help me to understand the advantages and disadvantages of these different storage types and develop a more efficient application for my users.

You can store small data in NSUserDefaults but when you have large database then you need sqlite or coredata for storing the database. use of coredatabase is good for big database this is provided by apple and it is to efficient in accessing database.

NSUserDefaults or document directory is used for small database(suppose need to store user name for single user or some other info).

You just need to know about sql queries to store data in a SQLite3 Database or You can use Core Data for back end storage. Core Data is one of the best options to use for storing data.

NSUserDefault should be used for storing small information.

You can use NSUserDefaults for storing any small data which you want to persist when your application closes. This you can use to store login details but yes if it is be secured, use keychain. You can definely use NSUserDefaults for storing setting options.

SQLite database is any easy way to store large data. Core Data is best option. but you can use SQLite if your application data is not too large. SQlite Database can also be used to store BLOB data eg to store pdf file bytes downloaded from server and whenever you want to use it, just write those bytes to pdf file. This will also keep data security since BLOB data in SQLite cannot be viewed.

Its good to use coreData for large data storage in the IPhone Memory space. ITs a wrapper on top of the database which helps us to store in the form of objects..... U can find many examples on 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