我正在开发的 iOS 应用程序导出 UTI。的相关部分Info.plist
看起来像这样:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>GPX Document</string>
<key>UTTypeIdentifier</key>
<string>de.company.app.gpx</string>
<key>UTTypeSize320IconFile</key>
<string>Doc320.png</string>
<key>UTTypeSize64IconFile</key>
<string>Doc64.png</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
</dict>
</dict>
</array>
我希望应用程序通过“在...中打开”对话框处理 GPX 文件,因此同一 PLIST 中还有一个文档类型定义(引用 UTI):
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon29.png</string>
<string>Icon58.png</string>
</array>
<key>CFBundleTypeName</key>
<string>de.company.app.gpx</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>de.company.app.gpx</string>
</array>
</dict>
</array>
在 Safari 中打开 GPX 文件时,它会显示我在下面指定的图标CFBundleTypeIconFiles
, i.e., Icon58.png
在视网膜设备上。该应用程序还允许通过 iOS 8 中引入的 UIDocumentPickerViewController 类进行导入,虽然 UTI 定义可以很好地过滤 iCloud Drive 中的相关文件,但它不会显示我指定的任何艺术品:
我已确保所有引用的图像文件(Icon29.png
, Icon58.png
, Doc64.png
, Doc320.png
)确实位于应用程序包的根目录中。它们名称中的数字表示它们的高度(以像素为单位)。这Doc...
文件是正方形,另外两个如下本规格 https://developer.apple.com/library/mac/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW9(仅限 iPhone)。
我基本上有两个问题:
1) 如何让 UIDocumentPickerViewController 显示 UTI 的自定义图标?
2)是否还有其他用例UTTypeSize64IconFile
and UTTypeSize320IconFile
被使用?