ios-sandbox mechanism (a brief description)

Source: Internet
Author: User

an iOS sandbox mechanism
      for security purposes, applications can only write their own data and preferences to a few specific locations. When the application is installed on the device, a home folder is created for it, which is the application sandbox. So the files are to be saved in this, like, icon, sound, image, attribute list, text file, etc. (for security reasons, the IOS places each app (including it preferences and data) in a sandbox at install time. A sandbox is a set of fine-grained controls that limit the app's access to files, preferences, network resources, hardware , and so on. As part of the sandboxing process, the system installs each app in its own sandbox directory, which acts as the home for T He app and its data.)
1. Each application has its own storage space2, the application can not turn over their walls to access the content of other storage space3, the application requests the data to pass the permission to detect, if does not meet the condition, will not be released.       Sandbox is a security system, the entire operation of the application through the system to run, the core content is: Sandbox applications run a variety of operation permissions restrictions.
      

Sandbox in the second simulator

Here's a look at where the emulator's sandbox directory is on your Mac computer. The sandbox files are in a hidden directory under the personal username directory, the Chinese is called the Resource library, in fact the library. To view the method:

Method 1 is able to set the display hidden file and then open it directly under finder. To set up a way to view hidden files such as the following: Open terminal, enter command

     command to display Mac hidden files: Defaults write Com.apple.finder appleshowallfiles-bool true      to hide mac hidden files command: Defaults write Com.apple.finder Appleshowallfiles-bool false      After you click Enter to exit the terminal, the Finder will be able to start again
      Restart Finder: Mouse click the Apple flag in the upper-left corner of the form and force exit-->finder->
Now you can see the repository catalog.
                                                   Locate the/application support/iphone simulator/folder after opening the repository. This is the sandbox folder for the emulator's various programs.        

Method 2 This method is more convenient, on the Finder point-to go to the directory, enter the/users/username/library/application support/iphone simulator/to go. Username here to write your user name. or ~/library/application Support/iphone simulator/(~ Represents the current User folder)


               

Three folder structure

by default, each sandbox contains 3 folders: Documents, Library, and TMP. Because of the sandbox mechanism, the application can only read and write files under these folders documents: Apple recommends that the file data that is created in the program or browsed in the program be saved in the folder, which is included in itunes Backup and restore.

Library: The default settings or other status information for the stored program;library/caches: Store cached files, itunes does not back up this folder, files under this folder will not be deleted in app exittmp: Provides a place to instantly create temporary files. itunes backs up all documents and library files while syncing with the iphone. When the iphone restarts, it discards all of the TMP files.
The three folders mentioned above: Documents, Library, TMP, Xxx.app
                      

Is the structure of a complete home folder:




The next section details the role of each folder in the sandbox and its access code.

References:https://developer.apple.com/library/ios/DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ Theiosenvironment/theiosenvironment.html

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.