我不明白为什么会出现此错误。我正在写事务中完成所有操作,对吗?
activeSchoolClassNotNull { activeSchoolClass ->
val schoolSubjects = ocjeneSkoleScraper.getSubjects()
realm.write {
activeSchoolClass.schoolSubjects = schoolSubjects.toRealmList()
copyToRealm(activeSchoolClass, updatePolicy = UpdatePolicy.ALL)
[email protected] = activeSchoolClass
}
}
谁能告诉我我做错了什么?
问题是我需要在修改它之前从领域获取最新的对象。
realm.write {
val latestObj = findLatest(obj)
latestObj.someProperty = "changed"
copyToRealm(latestObj)
}