On the iOS platform, each app has a storage space to store photos, sound files, text, attribute lists, and so on, which we call sandbox. In the sandbox, the app can read and write files on its own, but only its own sandbox, inaccessible to other app sandboxes, and cannot communicate with each other unless through URL Scheme.
In iOS development , Documents, libraries, and temp are the root structure of the sandbox, but what is the difference between them?
Documents: Used to store user data, itunes Backup and restore will include this directory, so the iOS developer typically stores the file data created in the program or browsed in the program in that directory.
Library: Contains two subdirectories, Caches and Preferences. Caches is used to store the files that the user needs to change. Preferences is the app's preferences and can be read and set through Nsuserdefaults.
TMP: For storing temporary files, this can put some files that are no longer needed when the app exits.
(see "iOS data storage " For more data storage information)
To understand the sandbox, we need to open the sandbox for details, here are two main ways to open the simulator sandbox:
Method One: Open in Folder
/users/maiziedu/library/application Support/iphone simulator/
Go to the folder directly at Finder->, and enter the contents above. Here I use the Wheat College computer for the explanation, everyone in the use of remember to replace the maiziedu with your computer user name.
Method Two: Search by finder
The sandbox of the app on the emulator is inside the repository of the user directory, but the repository is often a hidden folder. So before you look at the sandbox, show the hidden folders first. Show commands for hidden files:
Defaults write Com.apple.finder Appleshowallfiles-bool true
Similarly, the command to hide hidden files:
Defaults write Com.apple.finder Appleshowallfiles-bool false
Change true to false;
Find steps such as:
This is the iOS app sandbox principle, root directory structure and viewing methods, not clear Pro, please bookmark.
An explanation of the sandbox mechanism developed by iOS