Multitouch Touches iteration causes Bad Access exception.

Multitouch Touches iteration causes Bad Access exception.
0.0 0


I’m trying to add multitouch to my existing game. When I try to iterate CCSet that contains touches I get Bad Access Exception as soon as I call iter**.
void MyDelegateClass::ccTouchesBegan
bool multitouch = pTouches~~>count > 1;
return ;
for ; it != pTouches~~>end;**it)
CCTouch* pTouch = (CCTouch*) (*it);
// Do something with pTouch…

It also happens in ccTouchMoved method. So every time I try to access more than one CCTouch object.

I have used this code in class that extends CCLayer using
onEnter method.

I have tried to this in my Scene class that implements CCTouchDelegate and register standard touch delegate onEnter method.

Game itself uses lot’s of targeted touch delegates but I have tried to test without em.

This happens in versions 2.1.0 and 2.1.3.


look at the TestCpp multitouch example. If it works there, should work in your project too


Thanks for help. It lead me to the right direction even problem was totally elsewhere.

I was using cocos 2d-x as static linked library. When I moved cocos 2d-x code as part of the project then everything works.