Is Realm blocking access to the database if iOS background fetch is running while at the same time opening the app?
I know it is on UWP because if I run a background task while running the app I get an exception "%USERPROFILE%\AppData\Local\Packages\appname\db_name.realm: Encrypted interprocess.". Is something similar happening on iOS?
Turns out NSFileProtection is kicking in when the device gets locked. See https://realm.io/docs/swift/latest/#using-realm-with-background-app-refresh
Make sure you put the database in a separate folder and set the protection on the folder. Trying to change the protection on the Documents folder itself will not work!