Keep a DB open for all screens

Hi all,

I am building an iOS app that uses a SQLite DB. My thought process when building was to add the DB as a public shared property to the App section, and in the Opening event make the DB connection so that it can then be shared by all screens within the app.

The DB definitely connects during app opening, but when I go to use it in a screen later on it gives a NillObjectException. What (probably basic) step am I missing? Do I need to declare it in each screen, or reconnect each time?

For Desktop, you’d have declared db as a property of the App, and then refer to it as app.db everywhere (except perhaps within app methods and event handlers, where db would do).

Since I have never done any mobile stuff, I don’t know the equivalent there.

Thanks, Tim. That is how I have it as per screenshot so this must be something peculiar to iOS development.

i was being stupid. i forgot to actually include the DB file in the build.