Post

Replies

Boosts

Views

Activity

Reply to NSBatchInsertRequest problem with decoding a simple Date
Please find below how my NSBatchInsertRequest looks like : if let backup = try? JSONSerialization.jsonObject(with: dataFile.read(), options: []) as? [String: Any] { do { if let categories = backup["categories"] as? [[String: Any]] { let _ = try managedContext.execute(NSBatchInsertRequest(entity: Category.entity(), objects: categories)) } if let storages = backup["storages"] as? [[String: Any]] { let _ = try managedContext.execute(NSBatchInsertRequest(entity: Storage.entity(), objects: data: storages)) } } catch { self.finish(with: RestoreError.parsingBackupFile) } }Do I need to iterate over each [[String:Any]] and convert data to the correct type explicitly before preparing the NSBatchInsertRequest ?
Jun ’20
Reply to Live Activity Not Working on Physical Device
I had the same issue, what I did to fix the issue, in the Widgets IntentTimelineProvider I had initialised the NSManagedContext in the constructor, just trying to remove this initialisation and putting it in the timeline method did fix the issue for me. I didn't have to separate the live activity in its own target and now both live activity and widgets are on the same target and working. If you initialise something like CoreData in the constructor of your IntentTimelineProvider in one the widgets you have try to move it out of there maybe it will fix your issue.
Mar ’24