Posts

Showing posts with the label struct

Cannot fetch the entries of core data

Image
Clash Royale CLAN TAG #URR8PPP Cannot fetch the entries of core data I have below code that it will populate the core database with entries from struct array. When I debug it seems that is sending correctly the data to the func iterateCoreData, but when I try to fetch the result I don't get anything. What it could possible be wrong that either not add the data to database or couldn't fetch them. I have tried the main syntax of saving and fetching with a plain array it works correctly. let managedObjectContext = self.persistentContainer.viewContext // this is the working method to save data to core data and then fetch it. /* guard let entity = NSEntityDescription.entity(forEntityName: "Journal", in: managedObjectContext) else { fatalError("There is no such entity!") } for id in journalNoteArray.id { let data = NSManagedObject(entity: entity, insertInto: man...