如何指定导入 .obj 文件的文件类型?
How do I specify a file type for importing .obj files?
我正在尝试让我的应用识别 .obj 文件以便导入。
我已尝试按照 this WWDC video 中的说明进行操作。
我试过指定为导入的 UTI 和导出的 UTI。两者都不会导致文件在 UIDocumentBrowserViewController
中可打开(文档图标变灰)。我也不明白我的本机文档格式是如何在浏览器中打开的。我已尝试从设备上删除并重新安装该应用程序。
我错过了什么?为什么这么不简单?
这是我得到的:
事实证明 iOS 已经知道 .obj 文件。在 macOS 上,我 运行 以下内容:
mdls myfile.obj
其中显示:
kMDItemContentType = "public.geometry-definition-format"
kMDItemContentTypeTree = (
"public.content",
"public.geometry-definition-format",
"public.text",
"public.data",
"public.item",
"public.3d-content"
)
所以 UTI 是 public.geometry-definition-format
。我不知道那是否已经指定了扩展名或者是更通用的类型。
以下工作使文件可在 UIDocumentBrowserViewController
中打开:
UTI 未在 the documentation 中声明(真令人惊讶!),因此我建议使用 mdls
查找 UTI。
我正在尝试让我的应用识别 .obj 文件以便导入。
我已尝试按照 this WWDC video 中的说明进行操作。
我试过指定为导入的 UTI 和导出的 UTI。两者都不会导致文件在 UIDocumentBrowserViewController
中可打开(文档图标变灰)。我也不明白我的本机文档格式是如何在浏览器中打开的。我已尝试从设备上删除并重新安装该应用程序。
我错过了什么?为什么这么不简单?
这是我得到的:
事实证明 iOS 已经知道 .obj 文件。在 macOS 上,我 运行 以下内容:
mdls myfile.obj
其中显示:
kMDItemContentType = "public.geometry-definition-format"
kMDItemContentTypeTree = (
"public.content",
"public.geometry-definition-format",
"public.text",
"public.data",
"public.item",
"public.3d-content"
)
所以 UTI 是 public.geometry-definition-format
。我不知道那是否已经指定了扩展名或者是更通用的类型。
以下工作使文件可在 UIDocumentBrowserViewController
中打开:
UTI 未在 the documentation 中声明(真令人惊讶!),因此我建议使用 mdls
查找 UTI。