【问题标题】:How to get UIManagedDocument to show up as a file package and not a folder如何让 UIManagedDocument 显示为文件包而不是文件夹
【发布时间】:2016-07-21 18:10:40
【问题描述】:

我正在开发一个基于 Core Data 文档的应用程序,使用 UIManagedObject 子类作为我的存储容器。

保存文件(到 iTunes 文件共享)时,文件显示为文件夹,而不是文件包。我希望它显示为单个文件,这样用户就不会意外地弄乱文件结构。

这是我到目前为止所做的。在我的子类中:

@implementation

- (NSString *)savingFileType {
    return @"com.app.filetype";
}

- (NSString *)fileNameExtensionForType:(NSString *)typeName
                         saveOperation:(UIDocumentSaveOperation)saveOperation {
    return @"ext";
}

@end

在目标信息中,我注册了导出的 UTI:

【问题讨论】:

    标签: ios objective-c core-data uimanageddocument


    【解决方案1】:

    而且……我终于想通了。

    在 info.plist 的“Exported UTIs”部分,将“com.apple.package”添加到自定义 UTI 的“Conforms To”字段中。

    【讨论】:

      猜你喜欢
      • 2014-04-13
      • 2016-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 2012-03-26
      相关资源
      最近更新 更多