iOS Developer Library

Developer

Foundation Framework Reference NSMetadataItem Class Reference

Options
Deployment Target:

On This Page
Language:

NSMetadataItem

The NSMetadataItem class represents the metadata associated with a file, providing a simple interface to retrieve the available attribute names and values.

Inheritance


Conforms To


Import Statement


import Foundation @import Foundation;

Availability


Available in iOS 5.0 and later.
  • An array containing the attribute keys for the metadata item’s values. (read-only)

    Declaration

    Swift

    var attributes: [AnyObject] { get }

    Objective-C

    @property(readonly, copy) NSArray *attributes

    Discussion

    This property contains an array of attribute keys, representing the values available from this metadata item. For a list of possible keys, see Attribute Keys.

    Import Statement

    import Foundation

    Availability

    Available in iOS 5.0 and later.

  • Returns the receiver’s metadata attribute name specified by a given key.

    Declaration

    Swift

    func valueForAttribute(_ key: String) -> AnyObject?

    Objective-C

    - (id)valueForAttribute:(NSString *)key

    Parameters

    key

    The name of a metadata attribute. See the “Constants” section for a list of possible keys.

    Return Value

    The receiver’s metadata attribute name specified by key.

    Import Statement

    import Foundation

    Availability

    Available in iOS 5.0 and later.

  • Returns a dictionary containing the key-value pairs for the attribute names specified by a given array of keys.

    Declaration

    Swift

    func valuesForAttributes(_ keys: [AnyObject]) -> [NSObject : AnyObject]?

    Objective-C

    - (NSDictionary *)valuesForAttributes:(NSArray *)keys

    Parameters

    keys

    An array containing NSString objects that specify the names of a metadata attributes. See the “Constants” section for a list of possible keys.

    Return Value

    A dictionary containing the key-value pairs for the attribute names specified by keys.

    Import Statement

    import Foundation

    Availability

    Available in iOS 5.0 and later.

  • Attribute keys that may be associated with an item.

    Declaration

    Swift

    let NSMetadataItemFSNameKey: NSString! let NSMetadataItemDisplayNameKey: NSString! let NSMetadataItemURLKey: NSString! let NSMetadataItemPathKey: NSString! let NSMetadataItemFSSizeKey: NSString! let NSMetadataItemFSCreationDateKey: NSString! let NSMetadataItemFSContentChangeDateKey: NSString!

    Objective-C

    NSString * const NSMetadataItemFSNameKey; NSString * const NSMetadataItemDisplayNameKey; NSString * const NSMetadataItemURLKey; NSString * const NSMetadataItemPathKey; NSString * const NSMetadataItemFSSizeKey; NSString * const NSMetadataItemFSCreationDateKey; NSString * const NSMetadataItemFSContentChangeDateKey;

    Constants

    • NSMetadataItemFSNameKey

      NSMetadataItemFSNameKey

      The value is an NSString object with the name of the item as seen in the file system.

      Available in iOS 5.0 and later.

    • NSMetadataItemDisplayNameKey

      NSMetadataItemDisplayNameKey

      The value is an NSString object with the display name of the item, which may be different then the file system name.

      Available in iOS 5.0 and later.

    • NSMetadataItemURLKey

      NSMetadataItemURLKey

      The value is an NSURL object that you can use to open the file.

      Available in iOS 5.0 and later.

    • NSMetadataItemPathKey

      NSMetadataItemPathKey

      The value is an NSString object that contains the full path to the file

      Available in iOS 5.0 and later.

    • NSMetadataItemFSSizeKey

      NSMetadataItemFSSizeKey

      The value is an NSNumber object that indicates the size (in bytes) of the file on disk.

      Available in iOS 5.0 and later.

    • NSMetadataItemFSCreationDateKey

      NSMetadataItemFSCreationDateKey

      The value is an NSDate object that contains the date and time that the file was created.

      Available in iOS 5.0 and later.

    • NSMetadataItemFSContentChangeDateKey

      NSMetadataItemFSContentChangeDateKey

      The value is an NSDate object that contains the date and time that the file contents last changed.

      Available in iOS 5.0 and later.

    Import Statement

  • Attribute keys that describe cloud-related information about the item.

    Declaration

    Swift

    let NSMetadataItemIsUbiquitousKey: NSString! let NSMetadataUbiquitousItemHasUnresolvedConflictsKey: NSString! let NSMetadataUbiquitousItemIsDownloadingKey: NSString! let NSMetadataUbiquitousItemIsUploadedKey: NSString! let NSMetadataUbiquitousItemIsUploadingKey: NSString! let NSMetadataUbiquitousItemPercentDownloadedKey: NSString! let NSMetadataUbiquitousItemPercentUploadedKey: NSString! let NSMetadataUbiquitousItemDownloadingStatusKey: NSString! let NSMetadataUbiquitousItemDownloadingErrorKey: NSString! let NSMetadataUbiquitousItemUploadingErrorKey: NSString!

    Objective-C

    NSString * const NSMetadataItemIsUbiquitousKey; NSString * const NSMetadataUbiquitousItemHasUnresolvedConflictsKey; NSString * const NSMetadataUbiquitousItemIsDownloadedKey; NSString * const NSMetadataUbiquitousItemIsDownloadingKey; NSString * const NSMetadataUbiquitousItemIsUploadedKey; NSString * const NSMetadataUbiquitousItemIsUploadingKey; NSString * const NSMetadataUbiquitousItemPercentDownloadedKey; NSString * const NSMetadataUbiquitousItemPercentUploadedKey; NSString * const NSMetadataUbiquitousItemDownloadingStatusKey; NSString * const NSMetadataUbiquitousItemDownloadingErrorKey; NSString * const NSMetadataUbiquitousItemUploadingErrorKey;

    Constants

    • NSMetadataItemIsUbiquitousKey

      NSMetadataItemIsUbiquitousKey

      The value is an NSNumber object that contains a Boolean indicating whether the item is stored in the cloud.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemHasUnresolvedConflictsKey

      NSMetadataUbiquitousItemHasUnresolvedConflictsKey

      The value is an NSNumber object that contains a Boolean indicating whether the item is currently in conflict with another version of the file somewhere else.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemIsDownloadedKey

      NSMetadataUbiquitousItemIsDownloadedKey

      The value is an NSNumber object that contains a Boolean indicating whether the current version of the item has been downloaded and is available locally.

      This constant is deprecated in iOS 7 and OS X v10.9; use NSMetadataUbiquitousItemDownloadingStatusKey instead.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • NSMetadataUbiquitousItemIsDownloadingKey

      NSMetadataUbiquitousItemIsDownloadingKey

      The value is an NSNumber object that contains a Boolean indicating whether the item is currently being downloaded to the local device.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemIsUploadedKey

      NSMetadataUbiquitousItemIsUploadedKey

      The value is an NSNumber object that contains a Boolean indicating whether the item has been uploaded to the cloud.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemIsUploadingKey

      NSMetadataUbiquitousItemIsUploadingKey

      The value is an NSNumber object that contains a Boolean indicating whether the current version of the item is currently being uploaded to the cloud.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemPercentDownloadedKey

      NSMetadataUbiquitousItemPercentDownloadedKey

      The value is an NSNumber object that contains the percentage of the file that has already been downloaded from the cloud. The value is a double in the range 0.0 to 100.0.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemPercentUploadedKey

      NSMetadataUbiquitousItemPercentUploadedKey

      The value is an NSNumber object that contains the percentage of the file that has already been uploaded to the cloud. The value is a double in the range 0.0 to 100.0.

      Available in iOS 5.0 and later.

    • NSMetadataUbiquitousItemDownloadingStatusKey

      NSMetadataUbiquitousItemDownloadingStatusKey

      The value is a string constant that indicates the download status of the item.

      Possible values of the string are given in Downloading Status Values.

      Available in iOS 7.0 and later.

    • NSMetadataUbiquitousItemDownloadingErrorKey

      NSMetadataUbiquitousItemDownloadingErrorKey

      The value is an NSError object that describes the problem that occurred when downloading the item from iCloud failed.

      Available in iOS 7.0 and later.

    • NSMetadataUbiquitousItemUploadingErrorKey

      NSMetadataUbiquitousItemUploadingErrorKey

      The value is an NSError object that describes the problem that occurred when uploading the item to iCloud failed.

      Available in iOS 7.0 and later.

    Import Statement

  • Possible values for the NSMetadataUbiquitousItemDownloadingStatusKey key.

    Declaration

    Swift

    let NSMetadataUbiquitousItemDownloadingStatusCurrent: NSString! let NSMetadataUbiquitousItemDownloadingStatusDownloaded: NSString! let NSMetadataUbiquitousItemDownloadingStatusNotDownloaded: NSString!

    Objective-C

    NSString * const NSMetadataUbiquitousItemDownloadingStatusCurrent; NSString * const NSMetadataUbiquitousItemDownloadingStatusDownloaded; NSString * const NSMetadataUbiquitousItemDownloadingStatusNotDownloaded;

    Constants

    • NSMetadataUbiquitousItemDownloadingStatusCurrent

      NSMetadataUbiquitousItemDownloadingStatusCurrent

      A string used as the value for NSMetadataUbiquitousItemPercentUploadedKey to indicate that there is a local version of this item and it is the most up-to-date version known to this device.

      Available in iOS 7.0 and later.

    • NSMetadataUbiquitousItemDownloadingStatusDownloaded

      NSMetadataUbiquitousItemDownloadingStatusDownloaded

      A string used as the value for NSMetadataUbiquitousItemPercentUploadedKey to indicate that there is a local version of this item available.

      The most current version will be downloaded as soon as possible.

      Available in iOS 7.0 and later.

    • NSMetadataUbiquitousItemDownloadingStatusNotDownloaded

      NSMetadataUbiquitousItemDownloadingStatusNotDownloaded

      A string used as the value for NSMetadataUbiquitousItemPercentUploadedKey to indicate that this item has not been downloaded yet.

      You can use startDownloadingUbiquitousItemAtURL:error: to download the item.

      Available in iOS 7.0 and later.

    Import Statement