1. IOS sandbox Mechanism
IOS creates a file system structure for each application to store the application files. This area becomes a sandbox, including audio, image, text, and other files.
1. Each application has its own storage space.
2. applications cannot access other program's bucket content
3. the data requested by the application must pass permission detection. If the request does not meet the conditions, the data will not be released.
2. Sandbox path
On the Finder, click-> go to the folder and enter/Users/username/Library/Application Support/iPhone Simulator.
Enter your username here.
The program code can directly find the path: NSHomeDirectory ();
Take an application of mine as an example to manually find the sandbox path
The last four files are common folders in the sandbox.
(1) Here, my application project name is AddressBook. Therefore, the first package contains some images, sounds, text files, and code files referenced in the project.
Each time the content in this file is run from the simulator, the source code is reinjected into the package, so it is a temporary buffer file. Generally, we put some unchanged configuration files and resource files into it,
So that each running program can be loaded and the program running cannot be changed.
This package cannot be opened directly by double-clicking. You can only right-click to display the package content.
(2) The Document folder is usually used to store files that may be modified by users and can be stored persistently.
For example, if there is a file named "addressBookList. plist" in this folder, the corresponding path is:
[Cpp]
NSArray * pathArray = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
NSString * path = [[pathArray objectAtIndex: 0] stringByAppendingPathComponent: @ "addressBookList. plist"];
(3) tmp: provides a place to create temporary files in real time.
(4) Library: the default setting or other State information of the storage program;