Problem with applicationShouldTerminate on iPhone
<p>I'm having a problem with applicationShouldTerminate.</p>

<p>What ever I do it seams that has no effect. Any help would be
appreciated.</p>

<p>I'm well versed in programing but this just gives me headache. Im going
over some basic tutorials for xcode , as I'm new to mac in general, and am currently looking at a simple flashlight app.</p>

<p>It exists but I would like to add a alert box here with option not to
quit.</p>

<pre><code>(void)applicationWillTerminate:(UIApplication *)application
{
    [application setIdleTimerDisabled:NO];
}
</code></pre>

<p>this has no effect, alert is closed even before its created.</p>

<pre><code>(void)applicationWillTerminate:(UIApplication *)application
{
    [application setIdleTimerDisabled:NO];
    UIAlertView *alertTest = [[UIAlertView alloc]
                          initWithTitle:@"This is a Test"
                          message:@"This is the message contained
                          with a UIAlertView"
                          delegate:self
                          cancelButtonTitle:@"Button #1"
                          otherButtonTitles:nil];

    [alertTest addButtonWithTitle:@"Button #2"];
    [alertTest show];
    [alertTest autorelease];

    NSLog(@"Termination");
}
</code></pre>

<p>I did some reading online and found that it should be possible to do
this with</p>

<pre><code>(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
</code></pre>

<p>But no mater where I put that declaration I get error: syntax error
before NSApplicationTerminateReply.</p>

<p>There is no syntax error except that xcode seems not to recognize
NSApplicationTerminateReply as valid input. </p>

<p>Any sample code would be greatly appreciated. </p>
