我正在使用下面的代码在核心数据中批量插入大量数据。创建了对象,但是缺少数据。字典数组在插入时具有正确的数据,但是当我检索数据时,我看到 nil 和不正确的数据显示,如示例图像所示。
let appDelegate = await NSApplication.shared.delegate as! AppDelegate
let context : NSManagedObjectContext = appDelegate.persistentContainer.newBackgroundContext()
let batchInsert = NSBatchInsertRequest(entityName: entityName.rawValue, objects: data)
let result = try? context.execute(batchInsert) as? NSBatchInsertResult
nil 输出不一致
传入的字典数据创建批量插入数据