this question may have been quite old, but I encountered the same problem today and I think I have found a pretty good solution to it:
In the AppDelegate, I do the following:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
SKView *view = (SKView *)self.window.rootViewController.view;
if ([view.scene isKindOfClass:[GameScene class]])
{
XGGameScene *scene = (GameScene *)view.scene;
[scene resumeGame];
}
}
And then in the GameScene
class itself, I update a BOOL to reflect that the app has just resumed from background:
- (void)resumeGame
{
// Do whatever is necessary
self.justResumedFromBackground = YES;
}
And finally, in the update: loop, I run the following:
- (void)update:(NSTimeInterval)currentTime
{
// Other codes go here...
// Check if just resumed from background.
if (self.justResumedFromBackground)
{
self.world.paused = YES;
self.justResumedFromBackground = NO;
}
// Other codes go here...
}
Hope this helps!