Each iOS app has its own app sandbox (the app sandbox is the file system directory) and is isolated from other file systems. Apps must stay in their sandbox, other apps can't access the sandbox
Apply the sandbox's file system directory as shown (assuming the name of the app is called network)
The root path of the emulator app sandbox is: (Apple is the user name, 7.1 is the emulator version)
/users/apple/library/application Support/iphone simulator/7.1/applications
Application Package: (the network in) contains all the resource files and executable files
Documents: Saves data that needs to be persisted when the app runs, and it backs up the directory when itunes synchronizes the device. For example, a game app can save a game archive in that directory
tmp: Saves the temporary data required to run the app, and then deletes the corresponding file from the directory when it is finished. When the app is not running, the system may also purge files in that directory. itunes does not back up this directory when syncing the device
library/caches: Saves data that needs to be persisted when the app runs, and itunes syncs the device without backing up the directory. Non-critical data with large storage volumes and no backup required
library/preference: Save all your app's preferences, and the iOS settings (settings) app will find the app's settings in that directory. This directory is backed up when itunes syncs the device
Common ways to get a sandboxed catalog:
Sandbox root directory: nsstring *home = nshomedirectory();
Documents: (2 ways)
Stitching the "Documents" string with the sandbox root
NSString *home = nshomedirectory();
NSString *documents = [Home stringbyappendingpathcomponent: @ "documents"];
Not recommended because a new version of the operating system may modify the directory name
Using the Nssearchpathfordirectoriesindomains function
Nsuserdomainmask representative from the user folder to find
YES represents the wavy character "~" in the expanded path
Nsarray *array = Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, NO);
In iOS, only one directory matches the parameters passed in, so there is only one element in the collection
NSString *documents = [array objectatindex:0];
tmp: nsstring *tmp = nstemporarydirectory();
library/caches: (2 ways similar to documents)
Stitching the "Caches" string with the sandbox root
Use the Nssearchpathfordirectoriesindomains function (change the function's 2nd parameter to: nscachesdirectory)
library/preference: Access to Settings information in this directory through the Nsuserdefaults class