iOS - UTI

一、UTI概念

 

1、什么是UTI

 

Uniform Type Identifier,是字符串,格式标识符。

根据UTI,可得到相应的其他类型的格式标识符。比如public.jpeg对应于:

 

  • A four-character file type code (an OSType) of 'JPEG'
  • A filename extension of .jpg
  • A filename extension of .jpeg
  • A MIME type of image/jpeg

 

2、可包含的字符集

 

可包含字符:字母,数字,点号,连字符。

 

3、UTI句法

 

反域名语法

 

  • com.apple.quicktime-movie
  • com.mycompany.myapp.myspecialfiletype
  • public.html
  • com.apple.pict
  • public.jpeg

 

4、继承

 

UTI与其他格式标识符的特点是可继承。比如 public.html 继承自 public.text ,声明可以打开 public.text 的应用同样可以打开 public.html。

支持多继承。比如 com.apple.application-package 继承自 com.apple.bundle 和 com.apple.package。

UTI可以说明物理和逻辑上两方面的类型。物理上分为文件夹、文件等类型;逻辑上分为图片、音频等类型。

 

5、Identifier Tags

 

每个UTI都可以有任意个Identifier Tags,这些Identifier Tags是UTI的等价替代物,比如filename extension, MIME type, or NSPasteboard type。

 

二、UTI相关函数

 

定义在MobileCoreServices库的UTType.h中

 

三、声明新的UTI

 

 

然后你就可以使用com.kingreader.umd标识符了~

苹果文档:
https://developer.apple.com/library/prerelease/watchos/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319-CH201-SW1

posted @ 2016-10-31 14:39  小Garfield  阅读(723)  评论(0编辑  收藏  举报