cmashinho
cmashinho

Reputation: 615

Swift - CoreData Faulting

I have object with name Coctail and his relationship(many-to-many) with name Tag. enter image description here

I want to get object Coctail from database (I use NSFetchedResultsController) and print his tags. But when I try get tags like this 'coctail.tags' I get this

Relationship 'tags' fault on managed object...

Also when I try to get counts of tags ('coctail.tags.count') I get 0.

I don't know what code you need.

Upvotes: 1

Views: 220

Answers (1)

cmashinho
cmashinho

Reputation: 615

You need to update the persistent properties of Coctail object to use latest values from the persistent store. To do this, you need use refresh(_ object: NSManagedObject, mergeChanges flag: Bool) method with true flag.

Faulting and Uniquing.

Upvotes: 1

Related Questions