Closed Ashok28 closed 8 years ago
This appears to be a segfault in object_isClass(_:)
, which itself is being called by Foundation's KVO machinery. I'd guess this is a bug in iOS rather than Realm. Have you filed a radar for this?
Not yet, will do. In the meantime, any idea for a workaround except deleting realm file?
Since this is happening when attempting to notify your KVO observers that their observed objects are being deleted, a workaround could to be unregister your KVO observers prior to calling deleteAll()
.
When you do file a radar on this, please share the number with us here so we can duplicate.
Thanks!
@Ashok28 did you manage to file a radar about this, or to work around this apparent KVO bug by deregistering your KVO observers prior to calling deleteAll()
?
Sorry for late response, I was travelling abroad for a week.
I've solved this issue by unregistering all KVO observers prior to calling deleteAll()
. I didn't submit radar yet as I'm having trouble replicating this issue in example project I was trying to create.
Alright, I'll close this then as it appears the bug is in Apple's own KVO machinery and you've managed to work around this.
If you do end up filing a radar about this, please share the radar number, I'd be happy to dupe.
@jpsim what does unregister your KVO observers prior to calling deleteAll(). actually mean??
m facing same issue... :(
@Rj707
I'm faced the same issue. call invalidate
on your NSKeyValueObservation
func foo {
... // fetch obj from Realm
self.observation = obj.observe(\.someKeyPath, {_, _ in})
}
deinit {
self.observation.invalidate
}
I'm experiencing crash, when calling deleteAll. This didn't occur before Realm 2.0
Code example
Version of Realm and Tooling
ProductName: Mac OS X ProductVersion: 10.12 BuildVersion: 16A322
Xcode 8.0 Build version 8A218a
/usr/local/bin/pod 1.1.0.rc.2 Realm (2.0.2) RealmSwift (2.0.2)
Crash Log