The primary path of the sandbox
- Documents
- Need to save files or data generated by the application itself , for example: game progress, drawing of graffiti software
- Files in the directory are automatically saved in ICloud
- Note: Do not save files downloaded from the network, otherwise you will not be able to shelves!
- Caches
- Save temporary files for later use , for example: Cached pictures, offline data (map data)
- The system does not clean up files in the cache directory
- a cleanup solution for the cache directory must be provided when program development is required
- Tmp
- Save temporary files that you do not need to use later
- Files in the TMP directory, the system will automatically clean up
- Restart your phone and the TMP directory will be emptied
- System also cleans up automatically when the system is running out of disk space
- Preferences
- User preferences, use
NSUserDefault
Direct Read and write!
- Before iOS8, if you want data to be written to disk in a timely manner, you also need to call a synchronous method
synchronize
iOS sandbox path