Directory | Description |
---|---|
AppName .app | This is the app’s bundle. This directory contains the app and all of its resources. You cannot write to this directory. To prevent tampering, the bundle directory is signed at installation time. Writing to this directory changes the signature and prevents your app from launching. You can, however, gain read-only access to any resources stored in the apps bundle. For more information, see the Resource Programming Guide The contents of this directory are not backed up by iTunes or iCloud. However, iTunes does perform an initial sync of any apps purchased from the App Store. |
Documents/ | Use this directory to store user-generated content. The contents of this directory can be made available to the user through file sharing; therefore, this directory should only contain files that you may wish to expose to the user. The contents of this directory are backed up by iTunes and iCloud. |
Documents/Inbox | Use this directory to access files that your app was asked to open by outside entities. Specifically, the Mail program places email attachments associated with your app in this directory. Document interaction controllers may also place files in it. Your app can read and delete files in this directory but cannot create new files or write to existing files. If the user tries to edit a file in this directory, your app must silently move it out of the directory before making any changes. The contents of this directory are backed up by iTunes and iCloud. |
Library/ | This is the top-level directory for any files that are not user data files. You typically put files in one of several standard subdirectories. iOS apps commonly use the 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 use these directories for user data files. The contents of the Library directory (with the exception of the Caches subdirectory) are backed up by iTunes and iCloud.For additional information about the Library directory and its commonly used subdirectories, see The Library Directory Stores App-Specific Files. |
tmp/ | Use this directory to write temporary files that do not need to persist between launches of your app. Your app should remove files from this directory when they are no longer needed; however, the system may purge this directory when your app is not running. The contents of this directory are not backed up by iTunes or iCloud. |
Documents
, Library
, and tmp
directories. You might do this to better organize the files in those locations.Documents/
. User data generally includes any files you might want to expose to the user—anything you might want the user to create, import, 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 that the user has downloaded to watch or listen to later.Library/Application support/
directory. In general, this directory includes files that the app uses to run but that should remain hidden from the user. This directory can also include data files, configuration files, templates and modified versions of resources loaded from the app bundle.Documents/
and 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 that can be re-created or downloaded must be excluded from the backup. This is particularly important for large media files. If your application downloads video or audio files, make sure they are not included in the backup.tmp/
Do i need a mac to publish ios apps. directory. Temporary data comprises any data that you do not need to persist for an extended period of time. Remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device. The system will periodically purge these files when your app is not running; therefore, you cannot rely on these files persisting after your app terminates.Library/Caches/
directory. Cache data can be used for any data that needs to persist longer than temporary data, but 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 are not limited to) database cache files and transient, downloadable content. Note that the system may delete the Caches/
directory to free up disk space, so your app must be able to re-create or download these files as needed./Users
directory) or on a network volume. Each user (regardless of privileges) has access to and control over the files in their own home directory. Directory | Usage |
---|---|
/Applications | This directory is where you install apps intended for use by all users of a computer. The App Store installs apps purchased by the user in this directory automatically. The Utilities subdirectory contains a subset of apps that are intended for use in managing the local system. This directory is part of the local domain. |
Library | There are multiple Library directories on the system, each one associated with a different domain or specific user. Apps should use the Library directory to store app-specific (or system-specific) resources. For detailed information about the contents of this directory and how you use it to support your apps, see The Library Directory Stores App-Specific Files. |
/Network | This directory contains the list of computers in the local area network. There is no guarantee that files located on network file servers will have the /Network directory at the beginning of their path. Path names vary depending on several factors, including how the network volume was mounted. For example, if the user uses the Connect to Server command to mount a volume, paths begin with the /Volumes directory. When writing code, assume that files on any volume other than the boot volume could be located on a network-based server. |
/System | This directory contains the system resources required by macOS to run. These resources are provided by Apple and must not be modified. This directory comprises the contents of the system domain. |
/Users | This directory contains one or more user home directories. The user home directory is where user-related files are stored. A typical user’s home directory includes the following subdirectories:
The preceding directories are for storing user documents and media only. Apps must not write files to the preceding directories unless explicitly directed to do so by the user. The sole exception to this rule is the Library directory, which apps may use to store data files needed to support the current user. Of the subdirectories, only the Public directory is accessible by other users on the system. Access to the other directories is restricted by default. |
Documents
and Desktop
directories should reflect only the documents that the user created and works with directly. Similarly, the media directories should contain only the user’s media files. Those directories must never be used to store data files that your app creates and manages automatically. If you need a place to store automatically generated files, use the Library
directory, which is designated specifically for that purpose. For information on where to put files in the Library directory, see The Library Directory Stores App-Specific Files. Application Support
, Cache
, temporary directories and other related documents stored within a directory located at a system-defined path that you can obtain by calling the NSHomeDirectory
function..
) character is hidden automatically. This convention is taken from UNIX, which used it to hide system scripts and other special types of files and directories. Two special directories in this category are the .
and .
directories, which are references to the current and parent directories respectively./bin
—Contains essential command-line binaries. Typically, you execute these binaries from command-line scripts. /dev
—Contains essential device files, such as mount points for attached hardware./etc
—Contains host-specific configuration files./sbin
—Contains essential system binaries./tmp
—Contains temporary files created by apps and the system./usr
—Contains non-essential command-line binaries, libraries, header files, and other data. /var
—Contains log files and other files whose content is variable. (Log files are typically viewed using the Console app.)/Volumes
directory, which contains a subdirectory for each mounted disk in the local file system from the command line. (The Finder provides a different user interface for accessing local disks.) In macOS 10.7 and later, the Finder also hides the ~/Library
directory—that is, the Library
directory located in the user’s home directory.NSFileManager
do not filter out files or directories that are normally invisible to users. Thus, code that uses these interfaces theoretically has a complete view of the file system and its contents. (Of course, a process really has access to only those files and directories for which it has appropriate permissions.) Applications
, Library
, Music
, Movies
. An app may similarly provide localized names for itself and for any directories it creates. displayNameAtPath:
method of NSFileManager
.Library
directory is where apps and other code modules store their custom data files. Regardless of whether you are writing code for iOS or macOS, understanding the structure of the Library
directory is important. You use this directory to store data files, caches, resources, preferences, and even user data in some specific situations.Library
directories throughout the system but only a few that your code should ever need to access:Library
in the current home directory—This is the version of the directory you use the most because it is the one that contains all user-specific files. In iOS, Library
is placed inside the apps data bundle. In macOS, it is the app’s sandbox directory or the current user’s home directory (if the app is not in a sandbox)./Library
(macOS only)—Apps that share resources between users store those resources in this version of the Library
directory. Sandboxed apps are not permitted to use this directory. /System/Library
(macOS only)—This directory is reserved for use by Apple.Directory | Usage |
---|---|
Application Support | Use this directory to store all app data files except those associated with the user’s documents. For example, you might use this directory to store app-created data files, configuration files, templates, or other fixed or modifiable resources that are managed by the app. An app might use this directory to store a modifiable copy of resources contained initially in the app’s bundle. A game might use this directory to store new levels purchased by the user and downloaded from a server. All content in this directory should be placed in a custom subdirectory whose name is that of your app’s bundle identifier or your company. In iOS, the contents of this directory are backed up by iTunes and iCloud. |
Caches | Use this directory to write any app-specific support files that your app can re-create easily. Your app is generally responsible for managing the contents of this directory and for adding and deleting files as needed. In iOS 2.2 and later, the contents of this directory are not backed up by iTunes or iCloud. In addition, the system removes files in this directory during a full restoration of the device. In iOS 5.0 and later, the system may delete the Caches directory on rare occasions when the system is very low on disk space. This will never occur while an app is running. However, be aware that restoring from backup is not necessarily the only condition under which the Caches directory can be erased. |
Frameworks | In macOS, frameworks that must be shared by multiple apps can be installed in either the local or user domain. The Frameworks directory in the system domain stores the frameworks you use to create your macOS apps. In iOS, apps cannot install custom frameworks. |
Preferences App outlook per mac. | This directory contains app-specific preference files. You should not create files in this directory yourself. Instead, use the NSUserDefaults class or CFPreferences API to get and set preference values for your app. In iOS, the contents of this directory are backed up by iTunes and iCloud. |
Documents
subdirectory (or one of its subdirectories) is presented to the user (via the iCloud UI in macOS and iOS) as a separate document that can be deleted individually. Anything not in Documents
or one of its subdirectories is treated as data and shown as a single entry in the iCloud UI.Documents
directory. Another example of files that might go in the Documents
directory are saved games, again because they are something that an app could potentially provide some sort of method for selecting.Documents
directory. Apps can create any subdirectories inside the container directory, so they can arrange private files as desired.public.text
—A public type that identifies text data.public.jpeg
—A public type that identifies JPEG image data.com.apple.bundle
—An Apple type that identifies a bundle directory.com.apple.application-bundle
—An Apple type that identifies a bundled app.NSDocument
, NSPasteboard
, and NSImage
, support UTIs. In iOS, UTIs are used to specify pasteboard types only..strings
extension identifies a resource file with localizable string data while the .png
extension identifies a file with image data in the portable network graphics format. Info.plist
file. The CFBundleDocumentTypes
key specifies the file formats that your app recognizes and is able to open. Entries for any custom file formats should include both a filename extension and UTI corresponding to the file contents. The system uses that information to direct files with the appropriate type to your app.CFBundleDocumentTypes
key, see Information Property List Key Reference. Class/Technology | Notes |
---|---|
For most tasks, it is safe to use the default NSFileManager object simultaneously from multiple background threads. The only exception to this rule is tasks that interact with the file manager’s delegate. When using a file manager object with a delegate, it is recommended that you create a unique instance of the NSFileManager class and use your delegate with that instance. You should then use your unique instance from one thread at a time. | |
Grand Central Dispatch | GCD itself is safe to use from any thread. However, you are still responsible for writing your blocks in a way that is thread safe. |
NSFileHandle , NSData , Cocoa streams | Most of the Foundation objects you use to read and write file data can be used from any single thread but should not be used from multiple threads simultaneously. |
Open and Save panels | Because they are part of your user interface, you should always present and manipulate the Open and Save panels from your app’s main thread. |
POSIX routines | The POSIX routines for manipulating files are generally designed to operate safely from any thread. For details, see the corresponding man pages. |
NSURL and NSString | The immutable objects you use to specify paths are safe to use from any thread. Because they are immutable, you can also refer to them from multiple threads simultaneously. Of course, the mutable versions of these objects should be used from only one thread at a time. |
NSEnumerator and its subclasses | Enumerator objects are safe to use from any single thread but should not be used from multiple threads simultaneously. |
MyVolume
in these commands with the name of your volume.--applicationpath
argument and installer path, similar to the way this is done in the command for El Capitan.createinstallmedia
command and the arguments that you can use with it, make sure that the macOS installer is in your Applications folder, then enter the appropriate path in Terminal: