UTI 唯一类型标识

时间:2021-12-06 18:28:45

本文转载至 http://blog.csdn.net/zaitianaoxiang/article/details/6657231

 

Adopting Uniform Type Identifiers采用统一类型标识符
Introduction to Uniform Type Identifiers Overview 统一类型标示符概述
Declaring New Uniform Type Identifiers声明新的统一类型标示符

From the documentation:

If your application uses proprietary data formats, you should declare them in the Info.plist file of your application bundle. Some guidelines:

  • Your UTI string must be unique. Following the reverse-DNS format beginning with com.companyName is a simple way to ensure uniqueness. While the system can support different UTI strings with the same specification, the reverse is not true.

  • If your code relies on third-party UTI types that may not be present on the system, you should declare those UTIs as imported types in your bundle.

  • Be sure to add conformance information if your proprietary type is a subtype of one or more existing types. In most cases you should not specify conformance to a nonpublic type, unless you are also declaring that type in your bundle. For a list of public and Apple-defined UTIs, see "System-Declared Uniform Type Identifiers"

如果你的应用程序用到专用的数据类型,你需要声明他们在你的应用程序绑定的info.plist文件。

一些提示:

你定义的统一类型标识 必须是特定的,随着com.companyName反向DNS格式开始是一个简单的方法,以确保其唯一性。虽然该系统可以支持不同的UTI的字符串按照同样的规格,反之则不行。

如果你的代码依赖第三方的UTI但是可能不存在于系统中,你应该声明UTI为绑定的导入类型

如果您的专有类型是一个或多个现有类型的一个子型,则必须要添加一致性的信息,在大多数情况下,你不应该为非公有制类型指定一致性,除非你也声明了此种类型在你的bundle中。

对于公众和苹果定义的UTI的列表,请参见“System-Declared Uniform Type Identifiers”