Hi all,
For some reason, when i switch from my app to another one and then back the scheduled update method stops being called.
In my scene's init i'm doing:
[self scheduleUpdate];
And i've declared the update method, which is called correctly when the application first starts:
- (void)update:(ccTime)dt {
NSLog(@"%f", dt);
[watch increaseTime:dt];
}
But when i press the home button and go back to the application it stops being called (i.e i stop seeing messages in NSLog).
Here are my AppDelegate methods regarding resume/pause/etc:
- (void)applicationWillResignActive:(UIApplication *)application {
[[CCDirector sharedDirector] pause];
[[[CCDirector sharedDirector] runningScene] pauseSchedulerAndActions];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[[CCDirector sharedDirector] replaceScene:self.menuScene];
[[CCDirector sharedDirector] resume];
}
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
[[CCDirector sharedDirector] purgeCachedData];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[CCDirector sharedDirector] stopAnimation];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[[CCDirector sharedDirector] startAnimation];
}
- (void)applicationWillTerminate:(UIApplication *)application {
[GameCenterManager saveState];
CCDirector *director = [CCDirector sharedDirector];
[[director view] removeFromSuperview];
[viewController_ release];
[window_ release];
[director end];
}
- (void)applicationSignificantTimeChange:(UIApplication *)application {
[[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
}
Am i doing something wrong? Is it a bug in Cocos? Any ideas?
Thanks in advance,
Pedro