Coredata Error "data: <fault>"

I faced the same problem while pulling data from CoreData ! So, I followed the way @jrturton instructed and implemented it in Swift 3:

Step 1 : Add import CoreData

Step 2 : Add the code below . .

let context = ( UIApplication.shared.delegate as! AppDelegate ).persistentContainer.viewContext
var request = NSFetchRequest<NSFetchRequestResult>()
request = Your_Entity_Name.fetchRequest()
request.returnsObjectsAsFaults = false
do {
    let arrayOfData = try context.fetch(request)
} catch {
    // Handle the error! 
}

Hope , it will help you . :)


This is expected behaviour, core data won't return full objects until you need to access the persistent values of the objects. Each of your returned objects will be a 'fault' until this point.

You can force the fetch request to return full objects using [request setReturnsObjectsAsFaults:NO], but in most cases what you have will be fine. Look at the documentation for NSFetchRequest for more information.

If you access one of the properties, core data will go to the persistent store and fetch the rest of your values, then you'll get the full description in the logs.

This seems to be such a common misunderstanding that I decided to write about it, here.