Hello everyone I would like to know what is the difference between NSUserDefaults
and .plist file. Thanks in advance.

- 105
- 6

- 245
- 4
- 10
-
You can check this SO Post, http://stackoverflow.com/questions/7058858/should-i-use-nsuserdefaults-or-a-plist-to-store-data – Adarsh V C Aug 28 '13 at 05:17
4 Answers
NSUserDefaults is also a PList but the main difference is that it is recommended to use NSUserDefualts for small data such as flags(for example "isUserLoggedIn" or "isFirstLaunch"), but use PLists for storing big hierarchal data.
Other than this You can store Plist in any location you want (allowed by iOS) but you cannot change the location on which NSUserdefauls are stored. It is defined by OS.

- 2,074
- 17
- 17
-
-
Let me clarify a bit more. Is there any way that end user can delete the data residing in NSUserDefaults or in .plist ? e.g. by removing the app from cash ? – Asfanur Aug 29 '13 at 00:04
-
@Asfanur: if the user is even having even a little knowledge about iFunBox or iExplorer then he can. – Vaibhav Gautam Aug 29 '13 at 06:18
You can think of NSUserDefaults
as an invisible .plist that you can read and write to, without ever being able to actually see the file. Using NSUserDefaults, you will be able to restore saved values even if the app has been killed in multitasking.
However, how you choose between .plist and NSUserDefaults should be based off of how much data you need to save. Apple recommends only saving small amounts of data to NSUserDefaults. If you need to save a lot of information then .plist is the way to go. Either that or of course Core-Data."
Reference : Difference between NSUserDefaults and .plist

- 2,314
- 1
- 20
- 37
To use NSUserDeafults or .plist(Property List) is base on your data, How much data you want to save.
NSUserDefaults is an invisible and .plist that you can read and write to, without ever being able to actually see the file.
If you have small number of data then store it in NSUserDefaults and If you have more data or information then store it in .plist file.
Thank you.

- 1
- 1

- 101
- 1
- 11
Both things used to store the values . NSUserdefaults is easy to store the values..just single line you can store values...

- 213
- 2
- 12