Cocos2d 奇怪的随机冻结 - 到底发生了什么?

发布于 2024-12-22 20:46:51 字数 601 浏览 3 评论 0原文

这个问题让我抓狂,我花了 5 天时间试图解决它。我在这里,迫切需要解决方案。

我正在 Cocos2d 上开发一个简单的游戏。循环方法:-(void)update:(CCTime)delta 在每个特定的时间间隔被调用。

这件事是从五天前开始发生的,天知道为什么。在游戏循环中间的任意随机点,即游戏循环开始后大约 10 秒(可能从 5 到 20 秒不等),它会毫无明显原因地冻结。仪器不会检测到任何东西,调试器也不会注意到任何东西。我注意到的是循环停止被调用。没有记忆问题或与之相关的任何问题。

没有特定的方法可以驱动冻结,这完全是随机的 同样的事情也会发生在 iPhone、iPad、iPod touch 上,无论它是否是唯一运行的应用程序,也无论它是 iOS 4.0 还是 5.0……仪器绝对没有检测到泄漏,也没有僵尸对象。

我再说一遍,这不是崩溃,只是游戏循环中的冻结。 PS:即使图形被冻结,音乐仍然在后台运行。

我使用的是 Xcode 4.2、iOS 5.0 和 Cocos2d 1.0.1,在 iPad 1、iPhone 4、3GS 和 iTouch 3g 上运行我的游戏,所有这些都运行在 iOS 5.0.1 上。同样冻结......

有什么想法吗?请帮忙!

This problem has driven me crazy, it's been 5 days I'm trying to solve it. Here I am, desperate for a solution.

I am developing a simple game on Cocos2d. A loop method : -(void)update:(CCTime)delta gets called every specific interval of time.

This thing started happening just 5 days ago and god knows why. At any random point in the middle of the game loop, around 10 seconds (could vary from 5 to 20 secs) after the beginning of the game loop, it will just freeze, for no apparent reason. Instruments won't detect anything, debugger won't notice a thing. All I noticed is that the loop stops being called. No memory problem, or anything related to it.

the

There's no specific method called that's driving that freeze, which is being completely random. Same thing happens on iPhone, iPad, iPod touch, wether its the only app running or not, and wether its iOS 4.0 or 5.0... There are absolutely no leaks detected from instruments, no Zombie objects either.

I repeat, this is not a crash, just a freeze in the game loop.
PS: the music still runs in the background even though the graphics are frozen.

I am on Xcode 4.2 with iOS 5.0 and Cocos2d 1.0.1, running my game on iPad 1, iPhone 4, 3GS and iTouch 3g all of them on iOS 5.0.1. Same freeze....

Any ideas? PLEASE HELP!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独﹏钓一江月 2024-12-29 20:46:51

好吧,我知道用 coco (版本 99.4)“停止”所有图形处理的可靠方法,同时触摸处理机制仍然完美工作。我刚刚检查了一个项目的旧版本,情况如下:

NSMutableDictionary *dic = [NSMutableDictionary dictionary];
[dic setObject:nil forKey:@"key"];

我刚刚在战斗场景总结和退出场景之一中添加了此方法,果然如此。我得到的是死机,无一例外,音乐和触摸处理仍然有效。日志仍然显示我的触摸处理例程已被处理并回调。这让我被踩了很长一段时间,现在我“模式化”了自己,摆脱了类似的明显错误。如果您的任何一个线程中发生类似的情况,应用程序将为您提供“冻结”位。希望你能找到你的根本原因。

Well, i know a sure fire way of 'stopping' all graphic processing with coco (ver 99.4), whilst the touch handling mechanisms are still perfectly working. I just checked back in an older version of a project and here it goes:

NSMutableDictionary *dic = [NSMutableDictionary dictionary];
[dic setObject:nil forKey:@"key"];

I just added this method in one of the combat scene wrapup and exit scenes, and sure enough. What i get is a dead stall, no exception whatsoever, music and touch handling still working. The log still shows that my touch processing routines are handled AND called back. This had me stomped for a long bit, and i now "pattern" myself out of similar obvious mistake. If something like this happens in any one of your threads, the app will give you the 'freeze' bit. Hope you can find your root cause.

毁梦 2024-12-29 20:46:51

查找任何发送到名称以“unschedule”开头的方法的消息。

如果这没有帮助,请在冻结发生后在 CCScheduler 类的“tick”方法中设置一个断点。如果 CCScheduler 没有“勾选”,请找出原因。如果它仍然打勾,请检查其列表中是否仍有任何选择器。为此,您可能需要在 CCScheduler 类的所有“取消调度”方法中设置断点,以找出谁取消调度方法以及原因。

Look for any occurrences of message sends to methods whose name begins with "unschedule".

If that doesn't help, set a breakpoint in the CCScheduler class in the method "tick" once the freeze happens. If the CCScheduler doesn't "tick", find out why. If it still ticks, check if it still has any selectors in its lists. To do that you may want to set breakpoints in all the "unschedule" methods of the CCScheduler class to find out who is unscheduling methods and why.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文