hive/README.md
Nicolas Werner
authored
This is somewhat of a workaround for an iOS issue we ran into. We use hive as the database for a chat application. To be able to show notifications when the app is in the background we use a Notification Service Extension and give the NSE access to the database, so that it can read the room names and such from the database. (We implemented a barebones hive reader in Swift for that.) Since the database is only opened read only while the app is suspended and we only read data from it and immediately close it again, we don't really have any concurrency issues. However, iOS unconditionally kills your application if it has any lockfiles open in a directory, that another process could access. Since we share a container with the NSE, our app gets killed any time it is backgrounded. There might be other ways to solve this, but since we already make sure the database can only be written to by one process, I think disabling the locks is the best option, since they are not needed in our case. Another option would be to lock more granularly or prepend an SQLite file header, but those seem like worse options to me. For reference, here is a an issue about how SQLCipher ran into that issue: https://github.com/sqlcipher/sqlcipher/issues/255