Cing
Cing

Reputation: 816

nsfetchedresultcontroller delete cache with name Swift 3

So i recently update xcode to 8.0 and now have swift 3.
And with the new update there was something changed with nsfetchedresultcontroller.
And after a lot of searching and trying i got i working again.
But i still have an error with the delete cache() function

This was my original code:

NSFetchedResultsController.deleteCache(withName: "Master")

but i get this error:

/Users/Camiel/Documents/Schoolcijfer/NeededNumber/Magister2,0/VakkenTableViewController.swift:208:36: Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'

Any help is appreciated.

Upvotes: 1

Views: 272

Answers (1)

OOPer
OOPer

Reputation: 47876

Try this:

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

NSFetchedResultsController has become a generic type in Swift 3, and you need to specify the generic parameter ResultType. When Swift cannot infer it, you need to specify it explicitly.

You always need to specify generic parameters, even if the class method has nothing to do with the parameters.

And the error message..., better send a bug report about it.

Upvotes: 5

Related Questions