mm24
mm24

Reputation: 9596

Understanding applicationSignificantTimeChange:

I find that sometimes my application (Cocos2d game) beheaves in a "buggy" way after a significant time change. For example:

Looking at the AppDelegate methods I found:

// next delta time will be zero
-(void) applicationSignificantTimeChange:(UIApplication *)application
{
    [[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
}

I was wondering, as this affects the director and the director affects the animations, is there a link for between this call and case 1 and case 2?

Upvotes: 3

Views: 3207

Answers (1)

James Webster
James Webster

Reputation: 32066

This is nothing to do with cocos2D or applicationSignificantTimeChange:

Notably for applicationSignificantTimeChange:

This method is called when the day changes, or if the device's time has been changed in the background for whatever reason (such as changes to time zone).
[Source]

I am assuming the "significant time change" you mention is just when you leave the game for a while (i.e. longer than a few minutes). In this case, it's most likely that you are observing the fact that the OS multitasking handler kills off background processes when the device is running low on memory, causing your app to restart as you describe in case 2.

In the cases where the app hasn't restarted, it's just the case that the OS hasn't killed your process.

Upvotes: 5

Related Questions