Sandbox mechanism in iOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.