I have the following code for testing purposes:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self customTouchHandler:touches];
}
- (v
It appears this is a bug in SKView's touchesBegan:
method. From what I can tell, Apple is using a dictionary to associate each UITouch
with the object that the touch methods should be forwarded to. From my testing it appears that if there are multiple touches that begin at the same time, only one of the touches gets added to the dictionary. As a result, your scene won't ever receive the touch-related method calls for the other touches, which is why you are seeing the difference between touchesStarted and touchesFinished.
If you subclass SKView and override the touchesBegan:
method, your scene should get the correct calls.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
NSSet *newSet = [NSSet setWithObject:touch];
[super touchesBegan:newSet withEvent:event];
}
}
This fixed the problem for me, but it's possible there might be some side effects from calling the super method multiple times.