The iphone sandbox model has four folders, what is the location of the permanent data store, and what is the simple way to get the path to the emulator .
Documents,tmp,app,Library.
(Nshomedirectory ()) manually saved files in documents
Nsuserdefaults saved files in the tmp folder
1. Documents Directory: You should write all the application data files to this directory. This directory is used to store user data or other information that should be backed up regularly.
2. Appname.app Directory: This is the application's package directory, which contains the application itself. Because the application must be signed, you cannot modify the contents of this directory at run time, which may cause the application to fail to start.
3.Library Directory: There are two sub-directories under this directory:Caches and Preferences
Preferences Directory: Contains the application's preferences file. Instead of creating a preference file directly, you should use the Nsuserdefaults class to get and set your application's preferences .
Caches directory: Used to hold application-specific support files, saving the information that is needed during application startup.
4. tmp Directory: This directory is used to store temporary files, saving information that is not needed during the application restart.
ways to get these directory paths:
1, get the Home directory path function :
NSString *homedir = Nshomedirectory ();
2. method for obtaining the Documents directory path :
Nsarray *paths = Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES);
NSString *docdir = [Paths objectatindex:0];
3, get the Caches directory path method:
Nsarray *PATHS1 = Nssearchpathfordirectoriesindomains (Nscachesdirectory, Nsuserdomainmask, YES);
NSString *cachesdir = [Paths objectatindex:0];
4. method to get the TMP directory path:
NSString *tmpdir = Nstemporarydirectory ();
iOS sandbox path