Asdrubal Asdrubal - 1 year ago 183
iOS Question

Type 'AnyObject' does not conform to protocol 'NSFetchRequestResult'

I just installed

Xcode 8 beta 2
iOS 10 beta
. I have an existing project where I updated from swift 2.3 to swift 3 based on a prompt from Xcode. I received an error with my code data code.

This was auto generated in the conversion from swift 2.3 to swift 3 by xcode

var fetchedResultsController: NSFetchedResultsController<AnyObject>!

the error I'm receiving is

Type 'AnyObject' does not conform to protocol 'NSFetchRequestResult'

I tried to conform AnyObject

extension AnyObject: NSFetchRequestResult {}

But I receive another error

enter image description here

I am not sure what I need to do or if my fetchedResultsController needs to be changed in the first place.

var fetchedResultsController: NSFetchedResultsController<Content>!

Answer Source

The Xcode converter likely was confused about what Entity you wanted to return in this fetched results controller. Replace AnyObject with the entity type you are fetching.

You should open a radar ( on this, since it should never suggest AnyObject here. At worst it should suggest NSManagedObject.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download