Cin*_*ing 1 nsfetchedresultscontroller swift3
所以我最近将 xcode 更新到 8.0,现在有了 swift 3。
随着新的更新,nsfetchedresultcontroller 发生了一些变化。
经过大量的搜索和尝试,我又开始工作了。
但是我仍然有删除缓存()函数的错误
这是我的原始代码:
NSFetchedResultsController.deleteCache(withName: "Master")
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
/Users/Camiel/Documents/Schoolcijfer/NeededNumber/Magister2,0/VakkenTableViewController.swift:208:36: Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏。
尝试这个:
NSFetchedResultsController<NSFetchRequestResult>.deleteCache(withName: "Master")
Run Code Online (Sandbox Code Playgroud)
NSFetchedResultsController在 Swift 3 中已经成为泛型类型,需要指定泛型参数ResultType。当 Swift 无法推断时,您需要明确指定它。
您总是需要指定泛型参数,即使类方法与参数无关。
和错误信息......,最好发送一个关于它的错误报告。