realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.32k stars 2.15k forks source link

Realm inconsistent data in background query #6432

Closed raphaels17 closed 4 years ago

raphaels17 commented 4 years ago

Bugs: I run the exact Same query

it returns zero when the app is on the foreground and else 24 ????. the correct value is zero. the realm is running on autorefresh... still the same result is I relaunch the app

Goals

have a correct result

Expected Results

queyr return zero in background

Actual Results

return last 24 objects

Code Sample

Version of Realm and Tooling

Realm framework version: 'RealmSwift', '~> 3.18.0'

Xcode version: Version 11.3.1

iOS/OSX version: 113.1

leemaguire commented 4 years ago

Hi,

Can you send us a sample app showing us how you are using Realm?

Thanks, Lee

raphaels17 commented 4 years ago

Found the mystery. due to the magic of threading, another one was modifying my realm in the background in a part of the code i didn't know. so quiet on the contrary realm works like a charm