An explanation of the sandbox mechanism developed by iOS

Source: Internet
Author: User

On the iOS platform, each app has a storage space to store photos, sound files, text, attribute lists, and so on, which we call sandbox. In the sandbox, the app can read and write files on its own, but only its own sandbox, inaccessible to other app sandboxes, and cannot communicate with each other unless through URL Scheme.

In iOS development , Documents, libraries, and temp are the root structure of the sandbox, but what is the difference between them?

Documents: Used to store user data, itunes Backup and restore will include this directory, so the iOS developer typically stores the file data created in the program or browsed in the program in that directory.

Library: Contains two subdirectories, Caches and Preferences. Caches is used to store the files that the user needs to change. Preferences is the app's preferences and can be read and set through Nsuserdefaults.

TMP: For storing temporary files, this can put some files that are no longer needed when the app exits.

(see "iOS data storage " For more data storage information)

To understand the sandbox, we need to open the sandbox for details, here are two main ways to open the simulator sandbox:

Method One: Open in Folder

/users/maiziedu/library/application Support/iphone simulator/

Go to the folder directly at Finder->, and enter the contents above. Here I use the Wheat College computer for the explanation, everyone in the use of remember to replace the maiziedu with your computer user name.

Method Two: Search by finder

The sandbox of the app on the emulator is inside the repository of the user directory, but the repository is often a hidden folder. So before you look at the sandbox, show the hidden folders first. Show commands for hidden files:

Defaults write Com.apple.finder Appleshowallfiles-bool true

Similarly, the command to hide hidden files:

Defaults write Com.apple.finder Appleshowallfiles-bool false

Change true to false;

Find steps such as:

This is the iOS app sandbox principle, root directory structure and viewing methods, not clear Pro, please bookmark.

An explanation of the sandbox mechanism developed by iOS

Related Article

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.