iOS sandbox (sanbox) mechanism

Source: Internet
Author: User

1.IOS sandbox mechanism

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

2. View the emulator Sandbox folder

To view the storage location of the emulator's sandbox folder on the Mac computer, the files are in a hidden folder under the personal User name folder, the Chinese is called the Repository, and his directory is actually the library.

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 (click on the Apple logo in the top left corner of the screen-force quit-Select Finder and click Restart), this time to reopen the finder to see the hidden files.

Then press into the appropriate folder, you can go to the emulator's sandbox file directory:

Then go into a simulator version, and here I am 5.1.

Then you can see that the applications is stored under the simulator installed in the development of the application, casually into one can see, a sandbox contains four parts:

respectively is

The . App file , which is a running application file;

documents, Apple recommends that the file data created in the program or browsed in the program be saved in the directory, which is included in itunes backup and restore;

Library, storage program default settings or other status information, under the library there are two subfolders caches and preferences:

Library/caches: Save the data (cache file) that is generated by the app when it runs, itunes does not back up the directory, and the files in this directory are not deleted at the app exit;

Library/preferences: The application's Preferences file, which is backed up when ITunes synchronizes the device. Instead of creating a preference file directly, you should use the Nsuserdefaults class to get and set your application's preferences.

tmp, Save the temporary data required to run the application, and then delete the corresponding files from the directory when the application is not running, the system may also clean up all the files in that directory. ITunes does not back up the directory when syncing the device.

Another simple way is to directly click the Finder icon right--go to the folder--Enter/users/username/library/application Support/iphone Simulator, and then confirm it. Username is the user name of your native computer.

However, some of the paths on the Xcode6 have been changed .

The path of the emulator is changed to:/users/username/library/developer/coresimulator.

Each file under the Devices folder corresponds to an emulator under Xcode6, which can be specific to which emulator is based on the Device.plist file under each folder:

The path to the sandbox in Xcode6 is:/users/username/library/developer/coresimulator/devices/simulator udid/data/containers/data/application /corresponding Application Folder

The path to the preferences directory in Xcode6 is:/users/username/library/developer/coresimulator/devices/simulator udid/data/containers/bundle/ applications/corresponding Application Folder/library/preferences

But found in the Preferences folder but nothing to see, by finding the corresponding bundle identifier Plist file found that the Nsuserdefault way to create a plist file specific path is:/users/username/ library/developer/coresimulator/devices/Simulator udid/data/library/ Preferences folder: Through the above can be seen through the Nsuserdefault created by the plist file the location of the real storage has changed, into the Emulator Repository folder under the Preferences folder, That is, when we delete the emulator in the application, the real plist file is not deleted, if you need to clear the preferences file needs to be deleted manually to the corresponding directory! Of course this is only in the case of the simulator, the real machine should not have this problem, the specific situation can be tried.

iOS sandbox (sanbox) mechanism

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.