-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
Goals
Use Realm to perform basic database operations
Expected Results
App should not encounter any Realm-related crashes
Actual Results
App crashes with the following log:
Terminating app due to uncaught exception 'RLMException', reason: 'ConstIterator copy failed'
Steps to Reproduce
The issue is intermittent. Crash happens when all objects are deleted using
try realm.write {
realm.deleteAll()
}
and try to perform operations like realm.add(objects, update: update).
Or could be possible it is due to copying the realm object using:
extension Object: DetachableObject { func detached() -> Self { let detached = type(of: self).init() for property in objectSchema.properties { guard let value = value(forKey: property.name) else { continue } if let detachable = value as? DetachableObject { detached.setValue(detachable.detached(), forKey: property.name) } else { // Then it is a primitive detached.setValue(value, forKey: property.name) } } return detached } }
Version of Realm and Tooling
ProductName: Mac OS X
ProductVersion: 10.15.5
BuildVersion: 19F101
Xcode version: 11.5
Build version: 11E608c
Cocoapods version: 1.9.3
Realm version: 5.0.2
RealmSwift version: 5.0.2