UTType Reference

Framework
/System/Library/Frameworks/MobileCoreServices.framework
Companion guide
Declared in
UTCoreTypes.h
UTType.h

Overview

Uniform Type Identifiers (or UTIs) are strings which uniquely identify abstract types. They can be used to describe a file format or an in-memory data type, but can also be used to describe the type of other sorts of entities, such as directories, volumes, or packages.

Type declarations appear in bundle property lists and tell the system several things about a type. Detailed information about the format and declaration of a UTI can be found in Uniform Type Identifiers Overview. A few key concepts that are found in the declaration include:

Functions by Task

Creating Uniform Type Identifiers

Obtaining Tags from Uniform Type Identifiers

Testing Uniform Type Identifiers

Obtaining Additional Type Information

OSType Conversion Utilities

Functions

UTCreateStringForOSType

Encodes an OSType into a string suitable for use as a tag argument.

CFStringRef UTCreateStringForOSType(OSType inOSType);
Parameters
inOSType

The OSType to convert.

Return Value

A string that encodes the OSType.

Discussion

The UTI functions assume that all alternate identifier tags can be represented as Core Foundation strings. OSTypes are integer-based rather than string-based, so to pass an OSType into a UTI function, you must call this function to convert it to a string.

Availability
  • Available in OS X v10.3 and later.
Related Sample Code
Declared In
UTType.h

UTGetOSTypeFromString

Decodes a tag string into an OSType.

OSType UTGetOSTypeFromString(CFStringRef inString);
Parameters
Term

A string that encodes an OSType.

Return Value

The OSType that was encoded in the string.

Discussion

You call this function to convert an OSType string returned by a UTI function back into the integer-based OSType.

Availability
  • Available in OS X v10.3 and later.
Related Sample Code
Declared In
UTType.h

UTTypeConformsTo

Returns whether a uniform type identifier conforms to another uniform type identifier.

Boolean UTTypeConformsTo(
   CFStringRef   inUTI,
   CFStringRef   inConformsToUTI);
Parameters
inUTI

A uniform type identifier to compare.

inConformsToUTI

The uniform type identifier to compare it to.

Return Value

Returns true if the uniform type identifier is equal to or conforms to the second type.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeCopyDeclaration

Returns a uniform type’s declaration.

CFDictionaryRef UTTypeCopyDeclaration(CFStringRef inUTI);
Parameters
inUTI

A uniform type identifier.

Return Value

A dictionary that contains the uniform type’s declaration, or NULL if no declaration for that type can be found.

Discussion

A uniform type identifier is declared in a bundle’s information property list (info.plist). This function extracts and returns a dictionary that contains the complete declaration of the uniform type identifier. This is useful when your application needs to access properties that does not have a built-in accessor function. For more information on the dictionary format, see Uniform Type Identifiers Overview.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeCopyDeclaringBundleURL

Returns the location of a bundle containing the declaration for a type.

CFURLRef UTTypeCopyDeclaringBundleURL(CFStringRef inUTI);
Parameters
inUTI

A uniform type identifier.

Return Value

A URL that points to the bundle that holds the uniform type identifier’s declaration, or NULL if a bundle that holds the declaration cannot be located.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeCopyDescription

Returns the localized, user-readable type description string associated with a uniform type identifier.

CFStringRef UTTypeCopyDescription(CFStringRef inUTI);
Parameters
inUTI

A uniform type identifier.

Return Value

A localized string describing the type, or NULL if no type description is available.

Discussion

The localized string that describes the uniform type is found in the type’s declaration.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeCopyPreferredTagWithClass

Translates a uniform type identifier to a list of tags in a different type classification method.

CFStringRef UTTypeCopyPreferredTagWithClass(
   CFStringRef   inUTI,
   CFStringRef   inTagClass);
Parameters
inUTI

The uniform type identifier to convert.

inTagClass

The class of the tags you want to return. For more information, see “Type Tag Classes”.

Return Value

An array of tags (as CFStrings), or NULL if there was no translation available to convert the uniform type identifier to the specified class.

Discussion

If the type declaration included more than one tag with the specified class, the first tag in the declared tag array is the preferred tag.

Availability
  • Available in OS X v10.3 and later.
Related Sample Code
Declared In
UTType.h

UTTypeCreateAllIdentifiersForTag

Creates an array of all uniform type identifiers for the type indicated by the specified tag.

CFArrayRef UTTypeCreateAllIdentifiersForTag(
   CFStringRef   inTagClass,
   CFStringRef   inTag,
   CFStringRef   inConformingToUTI);
Parameters
inTagClass

The class of the inTag parameter. For more information, see “Type Tag Classes”.

inTag

The tag to translate into a uniform type identifier.

inConformingToUTI

If not nil, all returned uniform type identifiers must conform to this parameter.

Return Value

An array of uniform type identifiers, or NULL if inTagClass is not a known tag class

Discussion

This function is used to translate a type declared using another declaration mechanism (for example, MIME types) into a uniform type identifier. This function searches all UTI declarations for a matching translation and returns all possible results. If a conforming parameter is assigned, the search is reduced to the subset of type identifiers that conform to that type.

If no result is found, this function creates a dynamic type beginning with the dyn prefix.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeCreatePreferredIdentifierForTag

Creates a uniform type identifier for the type indicated by the specified tag.

CFStringRef UTTypeCreatePreferredIdentifierForTag(
   CFStringRef   inTagClass,
   CFStringRef   inTag,
   CFStringRef   inConformingToUTI);
Parameters
inTagClass

The class of the inTag parameter. For more information, see “Type Tag Classes”.

inTag

The tag to translate into a uniform type identifier.

inConformingToUTI

If not NULL, the returned uniform type identifier must conform to this parameter.

Return Value

A new CFStringRef containing a uniform type identifier, or NULL if inTagClass is not a known tag class

Discussion

This function is used to translate a type declared using another declaration mechanism (for example, MIME types) into a uniform type identifier. This function searches all UTI declarations for a matching translation. If a conforming parameter is assigned, the search is reduced to the subset of type identifiers that conform to that type.

If there is more than one possible UTI for the specified tag, the UTI that will be returned is undefined. See UTTypeCreateAllIdentifiersForTag if you need to see all search results.

If no result is found, this function creates a dynamic type beginning with the dyn prefix. This allows you to pass the UTI around and convert it back to the original tag.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

UTTypeEqual

Returns whether two uniform type identifiers are equal.

Boolean UTTypeEqual(
   CFStringRef   inUTI1,
   CFStringRef   inUTI2);
Parameters
inUTI1

A uniform type identifier.

inUTI2

The uniform type identifier to compare it to.

Return Value

Returns true if the two uniform type identifiers are equivalent.

Discussion

If one or both of the identifiers is a dynamic identifier, then the types are equal if either identifier's tag specification is a subset of the other identifier's tag specification.

Availability
  • Available in OS X v10.3 and later.
Declared In
UTType.h

Constants

Type Declaration Dictionary Keys

These are keys for values found in a UTI dictionary. For more information about UTI dictionaries, see Uniform Type Identifiers Overview.

const CFStringRef kUTExportedTypeDeclarationsKey;
const CFStringRef kUTImportedTypeDeclarationsKey;
const CFStringRef kUTTypeIdentifierKey;
const CFStringRef kUTTypeTagSpecificationKey;
const CFStringRef kUTTypeConformsToKey;
const CFStringRef kUTTypeDescriptionKey;
const CFStringRef kUTTypeIconFileKey;
const CFStringRef kUTTypeReferenceURLKey;
const CFStringRef kUTTypeVersionKey;
Constants
kUTExportedTypeDeclarationsKey

An array of exported UTI declarations.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTImportedTypeDeclarationsKey

An array of imported UTI declarations.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeIdentifierKey

The uniform type identifier for the declared type. This key is required.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeTagSpecificationKey

A dictionary containing conversions of the uniform type identifier to equivalent tags in other classification schemes. See “Type Tag Classes” for examples.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeConformsToKey

The UTIs to which this identifier conforms.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeDescriptionKey

A user-visible description of this type (may be localized).

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeIconFileKey

The name of the bundle icon resource to associate with this UTI.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeReferenceURLKey

The URL of a reference document describing this type.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTypeVersionKey

A version string.

Available in OS X v10.3 and later.

Declared in UTType.h.

Type Tag Classes

These strings identify other tagging classification schemes that a uniform type identifier can be converted to and from.

const CFStringRef kUTTagClassFilenameExtension;
const CFStringRef kUTTagClassMIMEType;
const CFStringRef kUTTagClassNSPboardType;
const CFStringRef kUTTagClassOSType;
Constants
kUTTagClassFilenameExtension

Indicates that the tag is a filename extension.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTagClassMIMEType

Indicates that the tag is a MIME type.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTagClassNSPboardType

Indicates that the tag is an NSPasteBoard type.

Available in OS X v10.3 and later.

Declared in UTType.h.

kUTTagClassOSType

Indicates that the tag is an OSType.

Available in OS X v10.3 and later.

Declared in UTType.h.

UTI Abstract Types

These are abstract uniform type identifiers that most other type identifiers are derived from.

const CFStringRef kUTTypeItem;
const CFStringRef kUTTypeContent;
const CFStringRef kUTTypeCompositeContent;
const CFStringRef kUTTypeApplication;
const CFStringRef kUTTypeMessage;
const CFStringRef kUTTypeContact;
const CFStringRef kUTTypeArchive;
const CFStringRef kUTTypeDiskImage;
Constants
kUTTypeItem

The generic abstract type identifier for most things (files, directories).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeContent

The abstract type identifier for anything containing user-viewable document content (documents, pasteboard data, and document packages).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeCompositeContent

The abstract type identifier for content formats supporting mixed embedded content (i.e., compound documents).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeApplication

The type identifier for Mac apps.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMessage

The abstract type identifier for messages (email, instant message, etc.).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeContact

The abstract type identifier for contact information( for example, a person, group, or organization).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeArchive

The abstract type identifier for an archive of files and directories.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeDiskImage

The type identifier for a data item mountable as a volume.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Concrete Types

These are uniform type identifiers for concrete types.

const CFStringRef kUTTypeData;
const CFStringRef kUTTypeDirectory;
const CFStringRef kUTTypeResolvable;
const CFStringRef kUTTypeSymLink;
const CFStringRef kUTTypeMountPoint;
const CFStringRef kUTTypeAliasFile;
const CFStringRef kUTTypeAliasRecord;
const CFStringRef kUTTypeURL;
const CFStringRef kUTTypeFileURL;
Constants
kUTTypeData

The type identifier for any sort of simple byte stream, including files and in-memory data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeDirectory

The type identifier for a file system directory, including packages and folders.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeResolvable

The type identifier for symbolic links and alias files.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeSymLink

The type identifier for a symbolic link.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMountPoint

The type identifier for a root directory of a volume.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeAliasFile

The type identifier for a fully-formed alias file.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeAliasRecord

The type identifier for raw alias data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeURL

The type identifier for the bytes of a URL.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeFileURL

The type identifier for the text of a "file:" URL.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Text Types

These are the uniform type identifiers for text content.

const CFStringRef kUTTypeText;
const CFStringRef kUTTypePlainText;
const CFStringRef kUTTypeUTF8PlainText;
const CFStringRef kUTTypeUTF16ExternalPlainText;
const CFStringRef kUTTypeUTF16PlainText;
const CFStringRef kUTTypeRTF;
const CFStringRef kUTTypeHTML;
const CFStringRef kUTTypeXML;
const CFStringRef kUTTypeSourceCode;
const CFStringRef kUTTypeCSource;
const CFStringRef kUTTypeObjectiveCSource;
const CFStringRef kUTTypeCPlusPlusSource;
const CFStringRef kUTTypeObjectiveCPlusPlusSource;
const CFStringRef kUTTypeCHeader;
const CFStringRef kUTTypeCPlusPlusHeader;
const CFStringRef kUTTypeJavaSource;
Constants
kUTTypeText

The type identifier for all text-encoded data, including text with markup (HTML, RTF, etc.).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypePlainText

The type identifier for text with no markup and in an unspecified encoding.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeUTF8PlainText

The type identifier for plain text in a UTF-8 encoding.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeUTF16ExternalPlainText

The type identifier for plain text in a UTF-16 encoding. If the encoded text does not include a byte order mark (BOM), the data has "external representation" byte order (big-endian).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeUTF16PlainText

The type identifier for plain text in a UTF-16 encoding in native byte order. The byte order mark (BOM) is optional. Correspondes to the 'utxt' OSType.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeRTF

The type identifier for Rich Text Format.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeHTML

The type identifier for HTML, any version.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeXML

The type identifier for XML data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeSourceCode

The abstract type identifier for source code (any language).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeCSource

The type identifier for C source code (.c).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeObjectiveCSource

The type identifier for Objective-C source code (.m).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeCPlusPlusSource

The type identifier for C++ source code (.cp, etc.).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeObjectiveCPlusPlusSource

The type identifier for Objective-C++ source code.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeCHeader

The type identifier for a C header.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeCPlusPlusHeader

The type identifier for a C++ header.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeJavaSource

The type identifier for Java source code.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Composite Content Types

Uniform type identifiers for content that includes multiple data types.

const CFStringRef kUTTypePDF;
const CFStringRef kUTTypeRTFD;
const CFStringRef kUTTypeFlatRTFD;
const CFStringRef kUTTypeTXNTextAndMultimediaData;
const CFStringRef kUTTypeWebArchive;
Constants
kUTTypePDF

The type identifier for Adobe PDF format.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeRTFD

The type identifier for Rich Text Format Directory (RTF with content embedding, on-disk format).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeFlatRTFD

The type identifier for Flattened RTFD (pasteboard format).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeTXNTextAndMultimediaData

The type identifier for MLTE (Textension) format for mixed text and multimedia data. Corresponds to the 'txtn' OSType.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeWebArchive

The type identifier for the WebKit web archive format

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Image Content Types

Uniform type identifiers for graphics content.

const CFStringRef kUTTypeImage;
const CFStringRef kUTTypeJPEG;
const CFStringRef kUTTypeJPEG2000;
const CFStringRef kUTTypeTIFF;
const CFStringRef kUTTypePICT;
const CFStringRef kUTTypeGIF;
const CFStringRef kUTTypePNG;
const CFStringRef kUTTypeQuickTimeImage;
const CFStringRef kUTTypeAppleICNS
const CFStringRef kUTTypeBMP;
const CFStringRef kUTTypeICO;
Constants
kUTTypeImage

The abstract type identifier for image data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeJPEG

The type identifier for a JPEG image.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeJPEG2000

The type identifier for a JPEG-2000 image.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeTIFF

The type identifier for a TIFF image.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypePICT

The type identifier for a Quickdraw PICT.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeGIF

The type identifier for a GIF image.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypePNG

The type identifier for a PNG image.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeQuickTimeImage

The type identifier for a QuickTime image. Corresponds to the 'qtif' OSType.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeAppleICNS

The type identifier for Apple icon data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeBMP

The type identifier for a Windows bitmap.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeICO

The type identifier for Windows icon data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Audio Visual Content Types

Uniform type identifier for audio and video content.

const CFStringRef kUTTypeAudiovisualContent;
const CFStringRef kUTTypeMovie;
const CFStringRef kUTTypeVideo;
const CFStringRef kUTTypeAudio;
const CFStringRef kUTTypeQuickTimeMovie;
const CFStringRef kUTTypeMPEG;
const CFStringRef kUTTypeMPEG4;
const CFStringRef kUTTypeMP3;
const CFStringRef kUTTypeMPEG4Audio;
const CFStringRef kUTTypeAppleProtectedMPEG4Audio;
Constants
kUTTypeAudiovisualContent

An abstract type identifier for audio and/or video content.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMovie

An abstract type identifier for a media format which may contain both video and audio. Corresponds to what users would label a "movie"

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeVideo

An abstract type identifier for pure video data(no audio).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeAudio

An abstract type identifier for pure audio data (no video).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeQuickTimeMovie

The type identifier for a QuickTime movie.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMPEG

The type identifier for a MPEG-1 or MPEG-2 movie.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMPEG4

The type identifier for a MPEG-4 movie.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMP3

The type identifier for MP3 audio.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeMPEG4Audio

The type identifier for a MPEG-4 audio layer (.m4a, or the MIME type audio/MP4).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeAppleProtectedMPEG4Audio

The type identifier for Apple protected MPEG4 format (.m4p, iTunes music store format).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Directory Types

Uniform type identifiers for different directory types.

const CFStringRef kUTTypeFolder;
const CFStringRef kUTTypeVolume;
const CFStringRef kUTTypePackage;
const CFStringRef kUTTypeBundle;
const CFStringRef kUTTypeFramework;
Constants
kUTTypeFolder

The type identifier for a a user-browsable directory (i.e., not a package).

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeVolume

The type identifier for the root folder of a volume/mount point.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypePackage

The type identifier for a packaged directory.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeBundle

The type identifier for a directory conforming to a CFBundle layout.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeFramework

The type identifier for directory conforming to an OS X framework.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Application Types

Uniform type identifiers for application types.

const CFStringRef kUTTypeApplicationBundle;
const CFStringRef kUTTypeApplicationFile;
Constants
kUTTypeApplicationBundle

The type identifier for a bundled application.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

kUTTypeApplicationFile

The type identifier for a single-file Carbon/Classic application.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Contact Types

Uniform type identifiers for contact types.

const CFStringRef kUTTypeVCard;
Constants
kUTTypeVCard

The type identifier for VCard format.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.

UTI Miscellaneous Types

Uniform type identifiers for types that do not fit in other categories.

const CFStringRef kUTTypeInkText;
Constants
kUTTypeInkText

The type identifier for Opaque InkText data.

Available in OS X v10.4 and later.

Declared in UTCoreTypes.h.