Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

App crash while processing SQLite

Hi. I have huge database and I fill my table at app launch, but if I interrupt my function by Home button and relaunch the app - it crashes, when i relaunch it again - it works, interrupt again - crash and so on. Looks like there is no way to prevent it. I cannot catch app exit event and this exception is not catchable by try-catch. I think it is because of unclosed DB handler. Please help

— asked April 16th 2010 by Vitali Virulaine
  • sqlite

5 Answers

  • repeated entry sorry ;)

    — answered April 16th 2010 by Mark Pierce
  • I am facing crashing problems as well.
    I do a search on a database and create a table with as many rows as the database returned result.

    After playing with the app (searching, etc.) for a while, the app crashes.
    I do close the rows and db after every use.

    Is there a GC I can call?

    What is the best way to create rows dynamically from database resultset?

    — answered April 17th 2010 by Peter Lum
  • Hi Vitaly

    Im interested in why your populating a huge database at application launch? is this every time or just first launch?

    Not understanding your app, it sounds like you might need to look a staging your events (if thats the right term)

    Could the app open and the alert the use its about to do an update? once completed allows the user to move on? that would help the user and probably the OS ;) im guess at this stage.

    If your able to give more info about what you need to do might help, although I understand non disclosure with apps.

    Sure one of the Appcelerator team will pipe in. Good luck and happy to help if I can.

    — answered April 17th 2010 by Mark Pierce
  • Hi there

    I have had crashes with SQLite code when I was opening/closing the database constantly. The Appcelerator guys suggested that I pass the (open) db handle around to prevent that problem - and it did.

    The Database layer code I have written (that mimics ActiveRecord) works that way - you can check out my code on http://github.com/jcfischer/TiStore


    — answered April 17th 2010 by Jens-Christian Fischer
  • My app works with database and I show the list of values when user opens the app (public transport stations), it cannot be done in other way. It takes some time and I show a toolbar with loading message. All works fine but if user switch the tab or close the app - it will crash at the next launch, what is worse I cannot catch any exception, it just shows the splashscreen and then closes but if I wait until loading is done and close the app - no crash, everything fine

    — answered April 18th 2010 by Vitali Virulaine
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.