Hello Realm Team ,
I am facing issue when updating realm object. Realm object updated successfully then got crash
Here is my code
func didUpdatedPills(pillAmount: Int, isAlarm: Bool) {
try! appDelegate.realm!.write {
if medObj.pillsIntStock.value != pillAmount{
medObj.pillsIntStock.value = pillAmount
}
if medObj.refillRemainder.value != isAlarm{
medObj.refillRemainder.value = isAlarm
}
}
}
And Crash
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception ‘RLMException’, reason: ‘Realm accessed from incorrect thread.’
terminating with uncaught exception of type NSException
CoreSimulator 732.18.0.2 - Device: iPhone 12 Pro Max (07EE0930-EF65-4C15-ADED-C5F7EF67DB8C) - Runtime: iOS 14.2 (18B79) - DeviceType: iPhone 12 Pro Max