ありがとうございます。
NSAppというオブジェクトがあるわけですね
しらべてみます。

あと、
applicationWillTerminate:
applicationShouldTerminate:
の区別がつかないかも