When database was moved to shared container iOS started to kill the application. It looks like it is caused by a shared database file which is locked when opened by the application (almost all the time). This issue never happened while testing in the simulator.
Andrzej Wójcik (Tigase) commented 5 years ago
The solution was not obvious and it took me some time to find out that iOS allows app to keep database open if it is in WAL journaling mode instead of SQLite3 default journaling mode (which is DELETE).
When database was moved to shared container iOS started to kill the application. It looks like it is caused by a shared database file which is locked when opened by the application (almost all the time). This issue never happened while testing in the simulator.