我发现有时我的应用程序(Cocos2d 游戏)在经过重大时间更改后会以错误"的方式运行.例如:
I find that sometimes my application (Cocos2d game) beheaves in a "buggy" way after a significant time change. For example:
查看我发现的 AppDelegate 方法:
Looking at the AppDelegate methods I found:
// next delta time will be zero
-(void) applicationSignificantTimeChange:(UIApplication *)application
{
[[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
}
我想知道,因为这会影响导演,而导演会影响动画,所以此调用与案例 1 和案例 2 之间是否存在联系?
这与cocos2D或applicationSignificantTimeChange:
特别是对于 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]
我假设您提到的重大时间变化"只是您离开游戏一段时间(即超过几分钟).在这种情况下,您很可能会观察到 当设备内存不足时操作系统多任务处理程序会终止后台进程,从而导致您的应用程序按照您在案例 2 中的描述重新启动.
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.
这篇关于了解 applicationSignificantTimeChange:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!