Use of the IOS directory

Source: Internet
Author: User

Table 1-1 commonly used directories of an IOS app

Directory

Description

AppName . App

This is the app ' S 

documents/

Use the This directory to store user-generated content. The contents of this directory can is made available to the user through file sharing; Therefore, his directory is should only contain files, and the wish to expose to the user. 

The contents of th Is directory was backed up by ITunes.

documents/inbox

Use the This directory to access files that your app WA s asked to open by outside entities. Specifically, the Mail program places emails attachments associated with your apps in this directory. Document interaction controllers may also place files in it. 

Your app can read and delete files in this direct Ory but cannot create new files or write to existing files. If the user tries to edit a file in this directory, your apps must silently move it out of the directory before making any Changes.

The contents of this directory is backed up by ITunes.

library/

This is the top-level directory for any files of User data files. You typically put files in one of the several standard subdirectories. IOS apps commonly use THE&NBSP, application support  and  Caches   subdirectories; However, you can create custom subdirectories.

Use the  Library,  subdirectories for any files, you don ' t want exposed to the user. Your app should not with these directories for user data files. 

The contents of the  Library &N Bsp;directory (with the exception of the  Caches  subdirectory) is backed up by ITunes.

For additional information on the Library directory and its commonly used subdirectories, See the Library Directory Stores app-specific files. 

tmp/

Use the This directory to the write temporary files that does not need to persist between launches of your app. Your app should remove files from the This directory when they is no longer needed; However, the system may purge the If your app is not running.

The contents of this directory is not backed up by ITunes.

An IOS app could create additional directories in Documents the, Library , and tmp directories. You might does this to better organize the files in those locations.

For information what to get references to the preceding directories from your IOS app, see locating Items in the Standard directories. For tips on where to put files, see where you should put Your App's files.

Where you should Put Your App ' s Files

To prevent the syncing and backup processes on IOS devices from taking a long time, being selective about where your place fil Es. Apps that store large files can slow down the process of backing up to ITunes or ICloud. These apps can also consume a large amount of a user ' s available storage, which may encourage the user to delete the app O R disable backup of that app's data to ICloud. Should store app data according to the following guidelines:

  • Put user data in Documents/ . User data generally includes any files-might want to expose-the user-anything you might want the user to create, IM Port, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files. Video and audio apps may even include files, the user have downloaded to watch, or listen to later.

  • Put app-created support files in the  library/application support/  directory . In general, this directory includes files and the app uses to run, and that should remain hi Dden from the user . This directory can also include data files, configuration files, templates and modified versions of resources loaded from The app bundle.

  • remember that files in  documents/  and &NBSP application support/  are backed up by default . You can exclude files from the backup by calling  -[nsurl SetResourceValue:forKey:error:]  using the  nsurlisexcludedfrombackupkey  key. Any file, can be re-created or downloaded must is excluded from the backup. This is particularly important for large media files. If your application downloads video or audio files, make sure they is not included in the backup .

  • Put temporary data in the  tmp/  directory. Temporary data comprises any data, and does not need the persist for a extended period of time. Remember to delete those files when you're done with them so, they do don't continue to consume space on the user's dev Ice. The system would periodically purge these files when your app was not running; Therefore, you cannot rely in these files persisting after your app terminates.

  • Put data cache files Library/Caches/ in the directory. The Cache data can is used for any data, needs to persist longer than temporary data, and not as long as a support file. Generally speaking, the application does not require cache data to operate properly, but it can use cache data to improve Performance. Examples of cache data include (but is not limited to) database cache files and transient, downloadable content. Note that the system could delete Caches/ the directory to free up disk space, so your app must is able to re-create Or download these files as needed.

In general, the content can be downloaded again, preferably in the library/caches/directory, regardless of size, when the file is deleted to have the logic to re-download! The library/caches/directory should be the most commonly used directory!

Use of the IOS directory

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.