Reprint is not all things can be put in. Nsuserdefaults only supports: NSString, NSNumber, NSDate, Nsarray, Nsdictionary. The Nsuserdefaults method used to record the permanent data is very convenient, do not need to read and write files, but retained in a nsdictionary dictionary, saved to the file by the system, the system will be saved to the application/library/preferences/ The Gongcheng.plist file.
It is important to note that if the program exits unexpectedly, Nsuserdefaults standarduserdefaults data is not written to the file by the system, but can be used [[Nsuserdefaults standarduserdefaults] Synchronize] Calling the Synchronize function will immediately update these defaults instead of waiting for the program to terminate to avoid data loss
If you save a custom class in a Nsarray, and then save it in Nsuserdefaults, it will not succeed. Do not believe can try, if you succeed please tell me.
What about that?
Workaround Join blog:http://blog.csdn.net/chyroger/article/details/5785297
IOS about Nsuserdefault