iOS Learning 7:ios Sandbox (sandbox) mechanism (i) Get sandbox path and directory description

Source: Internet
Author: User

Ext.: http://my.oschina.net/joanfen/blog/151145

One, iOS sandbox mechanism

iOS apps can only access areas created for the app, inaccessible to other areas, and other non-code files for the app are present in this directory, including pictures, properties files, plist,bundle,nib files, and so on, which is known as the Sandbox (sandbox).

    1. Each app has its own storage space, which is the sandbox
    2. Apps can only access their own sandbox, not other areas
    3. If the application requires file operations, the files must be stored in the sandbox, especially the database files, which can be accessed when operating on the computer, but if they are available on a real machine, the database files must be copied to the sandbox.

Second, open the sandbox path

1. If you do not know the sandbox path, you can print its path in your own app.

?
1 NSLog(@"沙盒路径:%@",NSHomeDirectory());

will get the printed result * is a letter or a number, that is, the path of the sandbox

?
1 /Users/apple/Library/Application Support/iPhone Simulator/6.1/Applications/******-****-****-****-************

Open Finder and select Go-to Folder (or select shortcut command+shift+g) to enter the printed path

2. Open Finder, select Go to and Hold option key to enter resource library

Select Application Support-iphone simulator-Select the emulator version to see the sandbox catalogs for each app.

Select one of the directories to see the app file with the name of the program.

Third, directory structure

Sandbox by default there are three directory folders Documents,library,tmp and app files that can only be manipulated in the appropriate folder

    • Documents: typically used to store files created in an application, such as database files, or file data that is browsed in a program. If you make a backup, the files in this folder will be included;
    • Library: Default settings and status information for storage applications;
    • Library/cache: Used to store cached files, the data in this folder will not be deleted when the app exits. This folder is not included in the backup;
    • TMP: Temporary file to store instant wear

App files with icons:

When selected, displays the contents of the package to see the stored icons, nib files, attribute lists, etc.

iOS Learning 7:ios Sandbox (sandbox) mechanism (i) Get sandbox path and directory description (GO)

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.