Type Alias

NSURLResourceKey

Keys that apply to file system URLs.

Declaration

typedef NSString *NSURLResourceKey;

Discussion

To request information using one of these keys, pass it to the forKey: parameter of the getResourceValue:forKey:error: instance method.

Topics

Directory Keys

NSURLIsDirectoryKey

Key for determining whether the resource is a directory, returned as a Boolean NSNumber object (read-only).

NSURLParentDirectoryURLKey

The parent directory of the resource, returned as an NSURL object, or nil if the resource is the root directory of its volume (read-only).

File Keys

NSURLFileAllocatedSizeKey

Key for the total size allocated on disk for the file, returned as an NSNumber object (read-only).

NSURLFileProtectionType

Protection level values that can be associated with a URL resource key.

NSURLFileResourceIdentifierKey

The resource’s unique identifier, returned as an id (read-only).

NSURLFileResourceTypeKey

The resource’s object type, returned as an NSString object (read-only). See NSURLFileResourceType for possible values.

NSURLFileSecurityKey

The resource’s security information, returned as an NSFileSecurity object (read-write).

NSURLFileSizeKey

Key for the file’s size in bytes, returned as an NSNumber object (read-only).

NSURLIsAliasFileKey

Key for determining whether the file is an alias, returned as a Boolean NSNumber object (read-only).

NSURLIsPackageKey

Key for determining whether the resource is a file package, returned as a Boolean NSNumber object (read-write in macOS 10.8 and later, read-only in previous versions). A true value means that the resource is a file package.

NSURLIsRegularFileKey

Key for determining whether the resource is a regular file, as opposed to a directory or a symbolic link. Returned as a Boolean NSNumber object (read-only).

NSURLPreferredIOBlockSizeKey

The optimal block size to use when reading or writing this file's data, returned as an NSNumber object, or nil if the preferred size is not available (read-only).

NSURLTotalFileAllocatedSizeKey

Key for the total allocated size of the file in bytes, returned as an NSNumber object (read-only). This includes the size of any file metadata.

NSURLTotalFileSizeKey

Key for the total displayable size of the file in bytes, returned as an NSNumber object (read-only). This includes the size of any file metadata.

Volume Capacity Keys

Checking Volume Storage Capacity

Confirm that you have enough local storage space for a large amount of data.

NSURLVolumeAvailableCapacityKey

Key for the volume’s available capacity in bytes (read-only).

NSURLVolumeAvailableCapacityForImportantUsageKey

Key for the volume’s available capacity in bytes for storing important resources (read-only).

NSURLVolumeAvailableCapacityForOpportunisticUsageKey

Key for the volume’s available capacity in bytes for storing nonessential resources (read-only).

NSURLVolumeTotalCapacityKey

Key for the volume’s total capacity in bytes (read-only).

Volume Status Keys

NSURLVolumeIsAutomountedKey

Key for determining whether the volume is automounted, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsBrowsableKey

Key for determining whether the volume is visible in GUI-based file-browsing environments, such as the Desktop or the Finder application, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsEjectableKey

Key for determining whether the volume is ejectable from the drive mechanism under software control, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsEncryptedKey

Whether the volume is encrypted, returned as NSNumber containing a Boolean value (read-only).

NSURLVolumeIsInternalKey

Key for determining whether the volume is connected to an internal bus, returned as a Boolean NSNumber object, or nil if it cannot be determined (read-only).

NSURLVolumeIsJournalingKey

Key for determining whether the volume is currently journaling, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsLocalKey

Key for determining whether the volume is stored on a local device, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsReadOnlyKey

Key for determining whether the volume is read-only, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsRemovableKey

Key for determining whether the volume is removable from the drive mechanism, returned as a Boolean NSNumber object (read-only).

NSURLVolumeIsRootFileSystemKey

Whether the volume is the root filesystem, returned as NSNumber containing a Boolean value (read-only).

Volume Support Keys

NSURLIsMountTriggerKey

Key for determining whether the URL is a file system trigger directory, returned as a Boolean NSNumber object (read-only). Traversing or opening a file system trigger directory causes an attempt to mount a file system on the directory.

NSURLIsVolumeKey

Key for determining whether the resource is the root directory of a volume, returned as a Boolean NSNumber object (read-only).

NSURLVolumeCreationDateKey

Key for the volume’s creation date, returned as an NSDate object, or NULL if it cannot be determined (read-only).

NSURLVolumeIdentifierKey

The unique identifier of the resource’s volume, returned as an id (read-only).

NSURLVolumeLocalizedFormatDescriptionKey

Key for the volume’s descriptive format name, returned as an NSString object (read-only).

NSURLVolumeLocalizedNameKey

The name of the volume as it should be displayed in the user interface, returned as an NSString object (read-only).

NSURLVolumeMaximumFileSizeKey

Key for the largest file size supported by the volume in bytes, returned as a Boolean NSNumber object, or nil if it cannot be determined (read-only).

NSURLVolumeNameKey

The name of the volume, returned as an NSString object (read-write). Settable only if NSURLVolumeSupportsRenamingKey is YES.

NSURLVolumeResourceCountKey

Key for the total number of resources on the volume, returned as an NSNumber object (read-only).

NSURLVolumeSupportsAdvisoryFileLockingKey

Key for determining whether the volume implements whole-file advisory locks in the style of flock, along with the O_EXLOCK and O_SHLOCK flags of the open function, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsCasePreservedNamesKey

Key for determining whether the volume supports case-preserved names, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsCaseSensitiveNamesKey

Key for determining whether the volume supports case-sensitive names, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsCompressionKey

Whether the volume supports transparent decompression of compressed files using decmpfs, returned as NSNumber containing a Boolean value (read-only).

NSURLVolumeSupportsExclusiveRenamingKey

Whether the volume supports exclusive renaming using renamex_np(2) with the RENAME_EXCL option, returned as NSNumber containing a Boolean value (read-only).

NSURLVolumeSupportsExtendedSecurityKey

Key for determining whether the volume supports extended security (access control lists), returned as a Boolean NSNumber object (read-only) (read-only).

NSURLVolumeSupportsFileCloningKey

Whether the volume supports cloning using clonefile(2), returned as NSNumber containing a Boolean value (read-only).

NSURLVolumeSupportsHardLinksKey

Key for determining whether the volume supports hard links, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsJournalingKey

Key for determining whether the volume supports journaling, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsPersistentIDsKey

Key for determining whether the volume supports persistent IDs, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsRenamingKey

Key for determining whether the volume can be renamed, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsRootDirectoryDatesKey

Key for determining whether the volume supports reliable storage of times for the root directory, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsSparseFilesKey

Key for determining whether the volume supports sparse files, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsSwapRenamingKey

Whether the volume supports renaming using renamex_np(2) with the RENAME_SWAP option, returned as NSNumber containing a Boolean value (read-only).

NSURLVolumeSupportsSymbolicLinksKey

Key for determining whether the volume supports symbolic links, returned as a Boolean NSNumber object (read-only).

NSURLVolumeSupportsVolumeSizesKey

Key for determining whether the volume supports returning volume size information, returned as a Boolean NSNumber object (read-only). If true, volume size information is available as values of the NSURLVolumeTotalCapacityKey andNSURLVolumeAvailableCapacityKey keys.

NSURLVolumeSupportsZeroRunsKey

Key for determining whether the volume supports zero runs, returned as a Boolean NSNumber object (read-only).

NSURLVolumeURLForRemountingKey

Key for the URL needed to remount the network volume, returned as an NSURL object, or nil if a URL is not available (read-only).

NSURLVolumeURLKey

The root directory of the resource’s volume, returned as an NSURL object (read-only).

NSURLVolumeUUIDStringKey

Key for the volume’s persistent UUID, returned as an NSString object, or nil if a persistent UUID is not available (read-only).

Ubiquitous Keys

Keys that describe the iCloud storage state of a file.

NSURLIsUbiquitousItemKey

A boolean NSNumber that contains true if this item is in iCloud storage, false if it is a local item (read-only).

NSURLUbiquitousItemDownloadRequestedKey

A Boolean indicating whether a call to startDownloadingUbiquitousItemAtURL:error: has already been made to download the item. The value of this key is read-only.

NSURLUbiquitousItemIsDownloadingKey

A boolean NSNumber that contains true if this item is being downloaded from iCloud, false otherwise (read-only).

NSURLUbiquitousItemDownloadingErrorKey

An error object that indicates why downloading the item from iCloud failed. See Foundation Constants for possible error codes.

NSURLUbiquitousItemDownloadingStatusKey

The current download state for the item, indicating whether a local copy exists and whether that copy is the most current version of the item. The possible values for this key are described in NSURLUbiquitousItemDownloadingStatus.

NSURLUbiquitousItemDownloadingStatus

Values that describe the iCloud storage state of a file.

NSURLUbiquitousItemIsUploadedKey

A boolean NSNumber that contains true if this item’s data has been uploaded to iCloud storage, false otherwise (read-only).

NSURLUbiquitousItemIsUploadingKey

A boolean NSNumber that contains true if this item is being uploaded to iCloud, false otherwise (read-only).

NSURLUbiquitousItemUploadingErrorKey

An error object that indicates why uploading the item to iCloud failed. See Foundation Constants for possible error codes.

NSURLUbiquitousItemHasUnresolvedConflictsKey

A boolean NSNumber that contains true if this item has conflicts outstanding, false otherwise (read-only).

NSURLUbiquitousItemContainerDisplayNameKey

A string containing the name of the item’s container, as it is displayed to the user.

Thumbnail Keys

NSURLThumbnailKey

All thumbnails as a single NSImage (read-write).

Deprecated
NSURLThumbnailDictionaryKey

A dictionary of NSImage/UIImage objects keyed by size (read-write). See NSURLThumbnailDictionaryItem for a list of possible keys.

Other Resource Keys

NSURLKeysOfUnsetValuesKey

Key for the resource properties that have not been set after the setResourceValues:error: method returns an error, returned as an array of NSString objects.

NSURLAddedToDirectoryDateKey

The time at which the resource’s was created or renamed into or within its parent directory, returned as an NSDate. Inconsistent behavior may be observed when this attribute is requested on hard-linked items. This property is not supported by all volumes. (read-only)

NSURLAttributeModificationDateKey

The time at which the resource’s attributes were most recently modified, returned as an NSDate object if the volume supports attribute modification dates, or nil if attribute modification dates are unsupported (read-only).

NSURLContentAccessDateKey

The time at which the resource was most recently accessed.

NSURLContentModificationDateKey

The time at which the resource was most recently modified.

NSURLCreationDateKey

The time at which the resource was created.

NSURLCustomIconKey

The icon stored with the resource, returned as an NSImage object, or nil if the resource has no custom icon.

NSURLDocumentIdentifierKey

The document identifier returned as an NSNumber (read-only).

NSURLEffectiveIconKey

The resource’s normal icon, returned as an NSImage object (read-only).

NSURLGenerationIdentifierKey

An opaque generation identifier, returned as an id <NSCopying, NSCoding, NSObject> (read-only)

NSURLHasHiddenExtensionKey

Key for determining whether the resource’s extension is normally removed from its localized name, returned as a Boolean NSNumber object (read-write).

NSURLIsExcludedFromBackupKey

Key for determining whether the resource is excluded from all backups of app data, returned as a Boolean NSNumber object (read-write).

NSURLIsExecutableKey

Key for determining whether the current process (as determined by the EUID) can execute the resource (if it is a file) or search the resource (if it is a directory), returned as a Boolean NSNumber object (read-only).

NSURLIsHiddenKey

Key for determining whether the resource is normally not displayed to users, returned as a Boolean NSNumber object (read-write).

NSURLIsReadableKey

Key for determining whether the current process (as determined by the EUID) can read the resource, returned as a Boolean NSNumber object (read-only).

NSURLIsSymbolicLinkKey

Key for determining whether the resource is a symbolic link, returned as a Boolean NSNumber object (read-only).

NSURLIsSystemImmutableKey

Key for determining whether the resource's system immutable bit is set, returned as a Boolean NSNumber object (read-write).

NSURLIsUserImmutableKey

Key for determining whether the resource's user immutable bit is set, returned as a Boolean NSNumber object (read-write).

NSURLIsWritableKey

Key for determining whether the current process (as determined by the EUID) can write to the resource, returned as a Boolean NSNumber object (read-only).

NSURLLabelColorKey

The resource’s label color, returned as an NSColor object, or nil if the resource has no label color (read-only).

NSURLLabelNumberKey

The resource’s label number, returned as an NSNumber object (read-write).

NSURLLinkCountKey

The number of hard links to the resource, returned as an NSNumber object (read-only).

NSURLLocalizedLabelKey

The resource’s localized label text, returned as an NSString object, or nil if the resource has no localized label text (read-only).

NSURLLocalizedNameKey

The resource’s localized or extension-hidden name, returned as an NSString object (read-only).

NSURLLocalizedTypeDescriptionKey

The resource’s localized type description, returned as an NSString object (read-only).

NSURLNameKey

The resource’s name in the file system, returned as an NSString object (read-write).

NSURLPathKey

The file system path for the URL, returned as an NSString object (read-only).

NSURLTagNamesKey

The names of tags attached to the resource, returned as an array of NSString values (read-write).

NSURLTypeIdentifierKey

The resource’s uniform type identifier (UTI), returned as an NSString object (read-only).

Deprecated

NSURLUbiquitousItemIsDownloadedKey

A boolean NSNumber that contains true if this item’s data has been downloaded to a ubiquity container, false otherwise (read-only).

Deprecated
NSURLUbiquitousItemPercentDownloadedKey

An NSNumber in the range 0–100 that indicates the percentage of the data that has been downloaded (read-only).

Deprecated
NSURLUbiquitousItemPercentUploadedKey

An NSNumber in the range 0–100 that indicates the percentage of the data that has been uploaded (read-only).

Deprecated

See Also

Accessing Resource Values

- resourceValuesForKeys:error:

Returns the resource values for the properties identified by specified array of keys.

- getResourceValue:forKey:error:

Returns the value of the resource property for the specified key.

- setResourceValue:forKey:error:

Sets the URL’s resource property for a given key to a given value.

- setResourceValues:error:

Sets the URL’s resource properties for a given set of keys to a given set of values.

- removeAllCachedResourceValues

Removes all cached resource values and temporary resource values from the URL object.

- removeCachedResourceValueForKey:

Removes the cached resource value identified by a given key from the URL object.

- setTemporaryResourceValue:forKey:

Sets a temporary resource value on the URL object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software