cocos2D deallocing CCScheduler

£可爱£侵袭症+ 提交于 2019-12-25 00:18:43

问题


This problem started happening when I subclassed CCSprite (Entity) to recieve touch input. When I'm going away from the main scene by pushing to another, I make all Entities remove their delegation from the shared CCTouchDispatcher (ie onExit()). And then reactivate when the main scene returns (onEnterTransistionFinished()).

Half of the times this works fine. However, the other times this happens:

cocos2d: deallocing <CCScheduler: 0x2323a0>

Which I find rather strange. Is it even plausible that the Touch Delegates are the cause of the problem? Or is it perhaps memory-related?


回答1:


Are you perhaps issuing [[CCScheduler sharedScheduler] release]? If so, don't do that.

The CCScheduler is a singleton. It should never deallocate by itself.




回答2:


If I remember correctly the problem originated from trying to register/unregister the same Entity to/from the TouchDispatcher twice (ie it didn't have time to unregister/register before I tried registering/unregistering it again).

I solved it by adding a little BOOL _didRegisterWithTouchDispatcher to avoid doing something like that.



来源:https://stackoverflow.com/questions/8913470/cocos2d-deallocing-ccscheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!