NSFetchedResultsController deleteCache in Swift 3

烂漫一生 提交于 2020-01-01 09:05:06

问题


Currently migrating to swift 3 and can't quite figure out what the parser wants for NSFetchedResultsController.deleteCache(withName: "rootCache")

With this syntax, I'm getting a "Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'" error when building.


回答1:


The error message is misleading. As of Swift 3, NSFetchedResultsController is a generic type

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

and the following should work:

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


来源:https://stackoverflow.com/questions/39517493/nsfetchedresultscontroller-deletecache-in-swift-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!