Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Uniform Type Identifier
A uniform type identifier (UTI) is a string that identifies a class of entities with a type. UTIs are typically used to identify the format for files or in-memory data types and to identify the hierarchical layout of directories, volumes or packages. UTIs are used either to declare the format of existing data or to declare formats that your application accepts. For example, OS X and iPhone applications use UTIs to declare the format for data they place on a pasteboard. Mac apps use UTIs to declare the types of files that they are able to open.
UTIs have several advantages over other type identification schemes:
The UTI naming convention is logical, and the syntax is well known.
UTIs can be related in a hierarchical fashion, like a family tree.
The list of UTIs can be extended by applications, meaning new types and subtypes can be created.
A UTI declaration includes metadata that describes the type, including a human-readable description, related UTIs, and conversion information to other identification schemes, such as MIME types or filename extensions.
UTIs Use the Reverse Domain Name System Convention
A UTI is defined as a string (
CFString) that follows a reverse Domain Name System (DNS) convention. The top-level domain (for instance,
com), comes first, followed by one or more subdomains, and ending in a token that represents the actual type. For example,
com.apple.application is an abstract base type that identifies applications. Domains are used only to identify a UTI’s position in the domain hierarchy; they do not imply any grouping of similar types.
UTIs in the
public domain are defined by Apple and are used to represent common formats.
UTIs in the
dyn domain are reserved. They are created automatically as a UTI-compatible wrapper around a type from another identification scheme when no defined conversion to a UTI exists.
Uniform Type Identifiers Are Declared in a Conformance Hierarchy
A conformance hierarchy is similar to a class hierarchy in object-oriented programming. All instances of a type lower in the hierarchy are also instances of a type higher in the hierarchy.
Conformance gives your application flexibility in declaring the types it is compatible with. Your application specifies what types it can handle, and all subtypes underneath it are automatically included. For example, the UTI
public.html, which defines HTML text, conforms to the
public.text identifier. An application that opens text files automatically opens HTML files.
A UTI conformance hierarchy supports multiple inheritance. Most UTIs can trace their conformance information to a physical UTI that describes how its physical nature and a functional UTI that describes how the data is used.
UTI properties are inherited at runtime. When a value is needed, the hierarchy is searched, starting first with the current type and then through its parent types.
OS X Applications Add New UTIs by Defining Them in an Application Bundle
Applications add a new UTI to the system by declaring the UTI in their information property list. Declarations include metadata to describe the UTI and its position in the conformance hierarchy.
Application-declared UTIs can be exported or imported. An exported UTI always represents the definitive declaration of the UTI. In contrast, an imported UTI is redeclared by another application. Imported declarations are useful when your application can read a file defined by another application but does not want to require that application to be installed on the target machine. If the operating system finds both an imported and an exported declaration, the exported declaration takes precedence.