Assertion Failed in function forceAddHandler, file CCTouchDispatcher.cpp, line 121

I am facing issue as mentioned below , i am using cocos2d-x 2.0 …

" Error is assertion failed: (0), function forceAddHandler file /Users/…/libs/cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp, line 121 "
i am using the sneaky button joystick in game…

I am not getting how to overcome… …
Please help me if someone solved this issue ….

Thanks in advance.
Mangesh

Did you solve it?

i have this error too!
i can’t solve it , really tired :frowning:

Hi,

Even i have the same problem, is anyone able to solve this problem ?

Thanks

In my case, I added “CCNode::onExit()” in onExit(). then assertions were removed.

I removed following line. then worked. Is it correct way ?

CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this, 0);

If you are porting and you had ported the line self.isTouchEnabled = YES;, you should comment that line.
cocos2d-x has handled this in a different way, which makes touches work by plainly adding the touch delegate.

fuuu, I got the same problem and finnally solved it
But firstly, where and when you got that Error.
For me, it happened when I recalled the

 Init()

function of the layer. When the Init() is called, cocos2d-x automatically sets touchEnable = false at first, and somehow, I don’t understand, the command

 this->setTouchEnable=true

in my Init() function causes the error accidentally. So the solution is that I setTouchEnable=false by myself before recalling the Init() function, something like this:@ this->setTouchEnable=false; this::init();@
It’s work!