The sandbox mechanism (sandbox) in iOS is a security system that specifies that an application can only read files within a folder created for the app and cannot access content elsewhere. All non-code files are saved in this place, such as slices, sounds, attribute lists, and text files.
1. Each application is within its own sandbox
2. You can't go across your sandbox to access the contents of another application sandbox
3. Applications requesting or receiving data outside the application require permission authentication
To view the storage location of the emulator's sandbox folder on your Mac computer, first of all, this folder is hidden, so to display these files first, open the command line:
command to display Mac hidden files: Defaults write Com.apple.finder appleshowallfiles-bool true
command to hide Mac hidden files: Defaults write Com.apple.finder Appleshowallfiles-bool false
Then restart the Finder, tap the apple logo in the upper left corner of the screen-force quit-Select Finder and click Restart, this time you can reopen the Finder to see the hidden files.
Another simple way is to directly click the Finder icon right--go to the folder--enter/users/your username/library/application support/iphone simulator/, and then confirm it. Your username is your native user name
The code to get the file, library, temp path is as follows:
#import "ViewController.h" @interface Viewcontroller () @end @implementation viewcontroller-(void) viewdidload {[Super V Iewdidload]; NSString *homepath = Nshomedirectory (); NSLog (@ "Home directory:%@", HomePath); Nsarray *docpath = Nssearchpathfordirectoriesindomains (Nsdocumentationdirectory, Nsuserdomainmask, YES); NSString *documentspath = [DocPath objectatindex:0]; NSLog (@ "Documents directory%@", Documentspath); Nsarray *cacpath = Nssearchpathfordirectoriesindomains (Nscachesdirectory, Nsuserdomainmask, YES); NSString *cachepath = [Cacpath objectatindex:0]; NSLog (@ "%@", CachePath); Nsarray *libspath = Nssearchpathfordirectoriesindomains (Nslibrarydirectory, Nsuserdomainmask, YES); NSString *librarypath = [Libspath objectatindex:0]; NSLog (@ "%@", LibraryPath); NSString *temppath = Nstemporarydirectory (); NSLog (@ "%@", TempPath); Do any additional setup after loading the view, typically from a nib.} -(void) Didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} @end
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Sandbox mechanism in iOS