NSFetchedResultsController

NSFetchedResultsController

本文介绍了Swift 3中的NSFetchedResultsController deleteCache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前正在迁移到swift 3,无法完全了解解析器对NSFetchedResultsController.deleteCache(withName: "rootCache")的需求

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

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

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

推荐答案

该错误消息具有误导性.从Swift 3开始,NSFetchedResultsController是通用类型

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")

这篇关于Swift 3中的NSFetchedResultsController deleteCache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 04:29