PDA

View Full Version : Quitting Application & Open Files




neil.b
Dec 10, 2008, 05:47 PM
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).



dejo
Dec 10, 2008, 06:09 PM
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).
Normally this is done in applicationWillTerminate: in your application delegate.

firewood
Dec 10, 2008, 06:31 PM
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.

.

neil.b
Dec 10, 2008, 06:35 PM
Thanks guys :)