1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Quitting Application & Open Files

Discussion in 'iPhone/iPad Programming' started by neil.b, Dec 10, 2008.

  1. macrumors member

    neil.b

    #1
    I've got the AudioQueue stuff working to play sound in my application but I'm wondering what happens to all the opened audio files if the user quits the app using the home button, for example.

    Do the open files get automatically closed?

    What about audio buffers etc?

    If I have to do manual cleaning up on exit, where do you do the cleaning up? I set a breakpoint in the dealloc method in my sound class but it doesn't seem to get called when the app is forced to quit (via the home button).
     
  2. Moderator

    dejo

    Staff Member

    #2
    Normally this is done in applicationWillTerminate: in your application delegate.
     
  3. macrumors 603

    #3
    The OS mops up everything on termination, but it's often cleaner for your app to clean up the way you want in the applicationWillTerminate delegate.

    It's also better for writing clean code and for debugging if you can account for everything in your termination delegate. e.g. if there's something you haven't closed or deallocated, it's a potential leak, etc.

    .
     
  4. macrumors member

    neil.b

    #4
    Thanks guys :)
     

Share This Page