一、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