Question

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.

Was it helpful?

Solution

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).

OTHER TIPS

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 e.g. 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...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top