- nskeyedarchiver: Saves data in an archived form, which is subject to the nscoding protocol, and the class that corresponds to the object must provide Encodewithcoder: and Initwithcoder: methods. The previous method tells the system how to encode the object, and the latter method tells the system how to decode the object. For example , save the Possession object archive.
- nsuserdefaults: Used to save application settings and properties, user-saved number nsuserdefaultsnsdatansstring nsnumber Nsdatensarraynsdictionary nsuserdefaults storage.
- write writing mode: permanently saved on disk. The method is: The first step: Get the path of the file is about to save: nsarray *documentpaths = Nssearchpathfordirectoriesindomains (Nsdocumentdirectory, nsuserdomainmask,yes);//c function nssearchpathfordirectoriesindomains To get the full path of the sandbox catalog he domain masknssearchpathdirectory iosnsuserdomainmask yesnsstring *ourdocumentpath =[documentpaths objectatindex:0];
- sqlite: Use sqlite database to store data. sqlite as a small and medium-sized database, the application of ios first step: Need to add sqlite related libraries and header files: build phaseslink binary library (ies) libsqlite3.0.dylib (libsqlite3.dylib< span class= "S2" > The difference between the former is not known, the two should be similar); Add a header file to the header file or source file in the project file #import "/usr/include/sqlite3.h" span class= "S2" > Step two: start using sqlite: NOTE: If you do not add any tables to the database, this database is not created and will not generate any files on the hard disk , if the database already exists, the database will open. &NBSP;
IOS four ways to store data