Closed saeedmozaffari closed 6 years ago
Beginning a write transaction will advance a Realm's local view of the data to reflect any changes made on different threads in the time since it was last refreshed. This means that if you are performing writes on multiple threads, any checks you do before starting a write transaction need to be repeated within the write transaction, as the state of your objects may have changed since you performed the checks. In this case, the object existed prior to advancing the version, but is deleted once the local view has been updated to reflect the deleteAll()
.
@tgoyne thanks, that's solution was useful
i have about 20 realm object class. after than i delete realm data and after than try for get object from database , realm return data to me but really not exist any data so when i want work with that returned object app will be crashed because not exist any data. so i got this error 'Object has been deleted or invalidated'"
in the other words
in my app after than user try for logout i user from following code for delete all realm objects value
after than i remove realm data when i try for get data from an object for example with the following code
realm will be return data !!! but really not exist any data in database!!! and now app will be crashed.
my app is open source. you can use it for reproduce this crash with logout and login again. App Source
Realm framework version: v3.6.0
Xcode version: v9.4.1
iOS/OSX version: 11