Pausing iPhone game from applicationWillResignActive
<p>I am trying to pause my app when the user hits the home button.</p>

<p>Here is how I pause the game in the GameViewController:</p>

<pre><code>- (void)pauseGame

{
     if (!gamePaused) {

    [gameTimer invalidate];

    [self pauseLayer:self.view.layer];

    gamePaused = TRUE;

    }
}
</code></pre>

<p>AppDelegate.h</p>

<pre><code>#import &lt;UIKit/UIKit.h&gt;

#import "GameViewController"

@class GameViewController;



@interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt; {    

    GameViewController *game;

}

@property (strong, nonatomic) UIWindow *window;
</code></pre>

<p>AppDelegate.m</p>

<pre><code>@interface AppDelegate()

@property (readonly) GameViewController *game;

@end


@implementation AppDelegate

@synthesize window = _window;



-(GameViewController *)game

{

   if (!game) {

      game = [[GameViewController alloc] init];

    }

    return game;

 }


- (void)applicationWillResignActive:(UIApplication *)application

{

   [self.game pauseGame];

}
</code></pre>

<p>This doesn't give me any errors or warnings, but it doesn't work. What am I doing wrong?</p>

<p>Thanks in advance!</p>
