Ext.: http://my.oschina.net/joanfen/blog/151145
One, iOS sandbox mechanism
iOS apps can only access areas created for the app, inaccessible to other areas, and other non-code files for the app are present in this directory, including pictures, properties files, plist,bundle,nib files, and so on, which is known as the Sandbox (sandbox).
- Each app has its own storage space, which is the sandbox
- Apps can only access their own sandbox, not other areas
- If the application requires file operations, the files must be stored in the sandbox, especially the database files, which can be accessed when operating on the computer, but if they are available on a real machine, the database files must be copied to the sandbox.
Second, open the sandbox path
1. If you do not know the sandbox path, you can print its path in your own app.
?
1 |
NSLog(@ "沙盒路径:%@" ,NSHomeDirectory()); |
will get the printed result * is a letter or a number, that is, the path of the sandbox
?
1 |
/Users/apple/Library/Application Support/iPhone Simulator/6.1/Applications/******-****-****-****-************ |
Open Finder and select Go-to Folder (or select shortcut command+shift+g) to enter the printed path
2. Open Finder, select Go to and Hold option key to enter resource library
Select Application Support-iphone simulator-Select the emulator version to see the sandbox catalogs for each app.
Select one of the directories to see the app file with the name of the program.
Third, directory structure
Sandbox by default there are three directory folders Documents,library,tmp and app files that can only be manipulated in the appropriate folder
- Documents: typically used to store files created in an application, such as database files, or file data that is browsed in a program. If you make a backup, the files in this folder will be included;
- Library: Default settings and status information for storage applications;
- Library/cache: Used to store cached files, the data in this folder will not be deleted when the app exits. This folder is not included in the backup;
- TMP: Temporary file to store instant wear
App files with icons:
When selected, displays the contents of the package to see the stored icons, nib files, attribute lists, etc.
iOS Learning 7:ios Sandbox (sandbox) mechanism (i) Get sandbox path and directory description (GO)