Archive: Saves an object in a format, also known as persistence.
1XML attribute List plist Archive (persistent)
2Preference (preference setting)
3NSKeyedArchiver Archiving
4sqlite3
5Core Data (manipulating SQLLite3)
Apply Sandbox
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. ( own virtual machine Xcode6.2 ios7.1)
1 NSLog (@ " sandbox path:%@", Nshomedirectory ());
will get the printed result * is a letter or a number, that is, the path of the sandbox
1 ---£º £37.692 private Address Book [31250:1282190 ] Sandbox path:/users/zjj/library/developer/coresimulator/devices/7ce3fb7e-052b-4b1d-8783-beafb45a3558/ data/containers/data/application/15b4c992-a4c6-4005-BF76-077EA5BBE9FC
Path is:/users/zjj/library/developer/coresimulator/devices
2. Open Finder, select Go-Go to Folder (or select shortcut key command+shift+g) Enter the printed path
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
- AppName. The package directory for the app application. Because the application must be signed, the content in this directory cannot be modified at run time, or the application will not start.
cache files and log files are best placed in this directory as well. ITunes does not back up this directory when syncing.
Library/preferences saves the application's preferences file (created when using the Nsuserdefaults class settings and should not be created manually).
- TMP: Saves the temporary data required to run the app, and when the iphone restarts, it clears all files in that directory.
The location of the iphone simulator has changed in Xcode 6。 At the same time, as mentioned in iOS 8 release note, the sandbox structure of the app has changed, and it is now divided into three containers, bundle containers, data containers, and icloud containers. IOS 8 App Sandbox directory structure such as:
Common ways for iOS app data storage ios7.1 application sandbox