iphone SDK - close app and/or go to sleep
<p>I am using the following code to call some save methods when my app is either closed or the iphone goes to sleep. I'm just checking they are both OK and correct to use this way? </p>

<pre><code>- (void)applicationWillResignActive:(UIApplication *)application {
    [self saveState];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [self saveState];
}
</code></pre>

<p>The saveState function simply sets a few NSuserdefaults...</p>

<p>Thanks for any info!</p>
