On 13 Aug 2015, at 6:32pm, skywind mailing lists <mailinglists at skywind.eu> wrote:
> Before my app closes I close the database explicitly. Though I do not know if > this happens always when the iDevice shuts down due to battery issues. iDevices shut down quite a time before they'd actually run out of power. Before your device shuts down your App will get notified that it's going to background, and then get notified that it's going to quit. If you're handling those two notifications properly (i.e. closing all SQLite connections at one or the other) then you should not be getting database corruption. Things to check are running your App inside some sort of memory logger, e.g. valgrind . I don't know if this is possible on the Xcode simulator, I think it's built in as a 'Tool'. And also to check the values returned from /all/ your SQLite calls, even ones like _close() where if they fail there's nothing you can do about it. If one of them is not SQLITE_OK then you should show an error message. The call which corrupts the database is sometimes an apparently harmless call. Simon.