The writing operation of Realm is asynchronous(?)... Then bind a Listener to the Result queried by the sub-thread to check whether it has been updated.
1. First of all, the IO operations involved should not be executed on the UI thread. 2. During asynchronous operations, there is no guarantee that the writing operation has been completed when reading. 3. The poster’s scenario is sequential. After the writing is successful, query again.
The writing operation of Realm is asynchronous(?)... Then bind a Listener to the Result queried by the sub-thread to check whether it has been updated.
1. First of all, the IO operations involved should not be executed on the UI thread. 2. During asynchronous operations, there is no guarantee that the writing operation has been completed when reading. 3. The poster’s scenario is sequential. After the writing is successful, query again.