您可以动态地将 CFBundleDocumentTypes 分配给您的 Cocoa 应用程序吗?这意味着在运行时我可以为我的应用程序分配更多扩展来处理。
目前,我为我的应用程序设置了一些扩展来处理 Info.plist 中的 CFBundleDocumentTypes,但我想在应用程序执行时(在运行时)通过代码来执行此操作。基本上,我可以在不修改 Info.plist 文件的情况下使启动服务了解新扩展。
Thanks.
At the moment, there’s no public API1 for an application to dynamically (un)register document types with Launch Services during runtime.
Open Emu http://openemu.org/就面临着这个问题。用户可以有选择地下载/安装模拟器,这些模拟器是其 Info.plist 文件定义文档类型的捆绑包。安装模拟器后,捆绑包中定义的类型需要是应用信息.plist。为此,Open Emu 重写了应用程序 Info.plist — 请参阅-更新 OEGameDocumentController 中的InfoPlist https://github.com/OpenEmu/OpenEmu/blob/master/OpenEmu/OEGameDocumentController.m#L369.
请注意,覆盖捆绑包 Info.plist 违反了 Mac App Store 的政策。
We have 场雷达 http://bugreport.apple.com要求运行时(取消)注册文档类型。我建议您也提交另一份文件,该文件应作为以下文件的副本关闭#2526726 http://rdar/problem/2526726。即使它是重复的,无论如何也必须将其归档,以便苹果公司估算需要此功能的人数。
1It might be possible via SPI, though. When I was looking into this, I stumbled upon _LSRegisterItemFromItemInfo()
in Launch Services.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)