NSTimers and NSTerminateLater (NSTimer->General)If your application has an open TCP connection to a server and you receive anapplicationShouldTerminate:message, you're likely to want to returnNSTerminateLaterso that you can first gracefully shut down the connection before quitting.There is a gotcha: returning
NSTerminateLaterstops the main runloop, so yourNSTimerswill stop working from that point on. Thus, if you were depending on a timer firing to finish up your shut-down process, you'll never see it, and you'll hang. The solution is to returnNSTerminateCancel, then do whatever you need to do and then terminate yourself manually. (Thanks to Larry Gerndt for this one!)