【问题标题】:NSFetchedResultsController deleteCache in Swift 3Swift 3 中的 NSFetchedResultsController deleteCache
【发布时间】:2016-09-15 17:58:26
【问题描述】:

目前正在迁移到 swift 3,但无法完全弄清楚解析器想要 NSFetchedResultsController.deleteCache(withName: "rootCache") 什么

使用这种语法,我得到一个“Type 'String?'构建时不符合协议'ExpressibleByStringLiteral'”错误。

【问题讨论】:

    标签: swift nsfetchedresultscontroller swift3


    【解决方案1】:

    错误信息具有误导性。从 Swift 3 开始, NSFetchedResultsController 是泛型类型

    open class NSFetchedResultsController<ResultType : NSFetchRequestResult> : NSObject { }
    

    以下应该可以工作:

    NSFetchedResultsController<NSFetchRequestResult>.deleteCache(withName: "rootCache")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多