【发布时间】:2011-06-23 14:26:04
【问题描述】:
我的应用程序处理*.mndl 类型的文件,这不过是自定义的*.plist。
到目前为止,我一直在使用*.plist 文件,但现在我想关联扩展名并能够从任何其他应用程序打开*.mndl 文件,我意识到将file.plist 重命名为file.mndl 不起作用。 (因此,我什至不知道我是否正确地进行了扩展关联和导出操作)
我从计算机向自己发送了一个文件file.mndl,当在 mail.app 中收到时,我得到了
file.mndl.plist(自动重命名,重置我的iPad时发生)
如何创建自己的 mndl 文件,同时能够使用 NSDictionary 类中的 +dictionaryWithContentsOfFile: 读取其内容?
即使我在使用 iOS,我也相信这类东西是从 MacOS 和 Cocoa 移植过来的。所以 Cocoa 开发人员也可以知道这一点。
感谢您的 cmets/答案。
谢谢
回答: 仅用于完成目的这是我在 info.plist 中添加的内容:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Mandala Chart File</string>
<key>UTTypeIdentifier</key>
<string>com.nacho4d.Accordion.mndl</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>mndl</string>
</dict>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Document320Icon.png</string>
<string>Document64Icon.png</string>
</array>
<key>CFBundleTypeName</key>
<string>Mandala Chart File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.nacho4d.Accordion.mndl</string>
</array>
</dict>
</array>
【问题讨论】:
-
是否需要
UTExportedTypeDeclarations和CFBundleDocumentTypes键来执行此操作?
标签: iphone cocoa cocoa-touch file-extension