Multiple touch issue on iOS platform.Did I miss something?

In the latest 3.0rc0 version,class EGLView has been renamed to GLView and function setMultipleTouchEnabled has gone!
I add the line into the AppController.mm and it worked!
[eaglView setMultipleTouchEnabled:YES];

Is it the proper place to enable multiple touch?

and during test, I noticed following error message frequently to be printed out,
“cocos2d: if the index doesn’t exist, it is an error”
Did I do something wrong?

Hi, I checked it and found out that the old EGLView doesn’t have a setMultipleTouchEnabled too.

I add the line into the AppController.mm and it worked!
[eaglView setMultipleTouchEnabled:YES];

Yes, that’s the way to enable multi-touch on iOS.

and during test, I noticed following error message frequently to be printed out,
“cocos2d: if the index doesn’t exist, it is an error”

Could you let us know how to reproduce this issue? Thanks.

To repeat the error, add touch listener and touch iOS device with two fingers.

	auto listener = EventListenerTouchOneByOne::create();
	listener->setSwallowTouches(true);
	
	listener->onTouchBegan = CC_CALLBACK_2(LocalJoystick::onTouchBegan, this);
	listener->onTouchMoved = CC_CALLBACK_2(LocalJoystick::onTouchMoved, this);
	listener->onTouchEnded = CC_CALLBACK_2(LocalJoystick::onTouchEnded, this);
	
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

When ou do this, you will get the “if the index doesn’t exist, it is an error” printed on line 304 of CCGLViewProtocol.cpp.

The problem is that you cast UITouch array to int array in CCEAGLView.mm (line 433), but on arm64 pointer is 64 bits, not 32 and the values in the array are totally messed up.
I suggest you using void*/intptr_t (will be the size of pointer) or long long (always 64-bit) for touch ids instead of int.

Thanks. I will test it on iphone5s

I created a ticket at http://www.cocos2d-x.org/issues/4559 . Thanks for your feedback. We 'll fix soon.

Fixed at https://github.com/cocos2d/cocos2d-x/pull/5989

Thank you!

You are now (commit ea6d4a3) including “#include <malloc.h>” in cpCollision.c, but there is no such file on OSX. Could you please revert it back to “#include <alloca.h>” or remove it at all, since alloca is not used anywhere and malloc is declared in stdlib.h?

Ok, I see that this is already fixed. Thank you!