Sandbox mechanism of IOS, iossandbox
Every App in IOS has a separate closed folder called sandbox, and Apple requires that no App can access the sandbox of other apps.
Sandbox directory
FOUNDATION_EXPORT NSString * NSHomeDirectory (void );
Or
Specifies the NSSearchPathDirectory enumerated value to search for subdirectories in the sandbox.
NSSearchPathDomainMask enumeration value, specifying the search range
Whether expandTilde expands the Tilde ~ (Whether to expand the full path)
NSArray * NSSearchPathForDirectoriesInDomains (NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde)
The Sandbox directory contains the following three directories:
- Documents stores long-term files
- The Library system temporarily stores files
- Tmp temporary files. files in this directory are cleared when the App restarts.
Other Path access methods in the sandbox
App Directory: [[NSBundle mainBundle] bundlePath]
Resource file path: [[NSBundle mainBundle] pathForResource: ofType: inDirectory: forLocalization:] All parameters are strings. This method has multiple reloads.
Tmp path: NSTemporaryDirectory ()