【问题标题】:Saving, Document Extensions, and Preferences (Info.plist)保存、文档扩展和首选项 (Info.plist)
【发布时间】:2013-04-29 17:03:55
【问题描述】:

我有一个简单的基于文档的 Cocoa 应用程序,名为“RaiseMan”。当我去保存文件时,控制台中会出现此消息:

-[NSDocumentController fileExtensionsFromType:] is deprecated, and does not work when passed a uniform type identifier (UTI). If the application didn't invoke it directly then the problem is probably that some other NSDocument or NSDocumentController method is getting confused by a UTI that's not actually declared anywhere. Maybe it should be declared in the UTExportedTypeDeclarations section of this app's Info.plist but is not. The alleged UTI in question is "com.bignerdranch.raiseman-doc".

如果我将当前文件另存为“Test”,则结果是一个以 .plist 格式打开的文件,并且不会使用 Raiseman 应用程序打开。如果我将它保存为“Test.rsmn”(显式输入扩展名),它会将其保存为 Raiseman 类型的文件,但是当我重新打开该文件时,我无法访问任何用户首选项或首选项面板 (.xib) .

上下文:我目前正在阅读 Aaron Hillegass 的 Mac OS X 编程,第 13 章...

【问题讨论】:

    标签: objective-c xcode save plist xib


    【解决方案1】:

    我的解决方案是创建一个新的 Exported UTI(如警告所述)并从 Document Type 复制数据。在Clean Build Folder (⇧⌘K) 之后警告消失了。我没有创建导入的 UTI。

    过程记录在here:

    如果您使用自己的 UTI 定义自定义文档类型,则必须导出 UTI。

    【讨论】:

      【解决方案2】:

      因此,为了达到预期的结果,我确保在项目 Targets 的属性检查器下,标识符和 UTI 类型(在文档类型表中)以及 .plist 文件中的 UT 类型标识符是都一样<key>UTTypeIdentifier</key> <string>"com.yourDomainName.ProductName"</string>。

      【讨论】:

      • 简而言之,如果您在“文档类型”中输入了文件类型,则需要在“导出的 UTI”和“导入的 UTI”中再次输入。
      • 其实就是“进口尿路感染”。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-10
      • 1970-01-01
      • 2014-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      相关资源
      最近更新 更多