@@ -60,6 +60,7 @@ - (id)init
6060
6161- (void )dealloc {
6262 components = Nil ;
63+ _touchSet = Nil ;
6364}
6465
6566- (BOOL )addComponent : (id <SKComponent>)component withName : (NSString *)name {
@@ -265,7 +266,14 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
265266 _touchState.absoluteLocation = _touchState.absoluteTouchStart ;
266267 _touchState.touchTime = 0 ;
267268 _touchState.isLongPress = NO ;
268- _touchState.isDragging = NO ;
269+ _touchState.isDragging = NO ;
270+
271+ // workaround for SpriteKit bug #15490329
272+ _touchSet = [NSHashTable weakObjectsHashTable ];
273+ for (UITouch *touch in touches) {
274+ [_touchSet addObject: touch];
275+ }
276+
269277 }
270278 }
271279}
@@ -312,8 +320,11 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
312320 }
313321
314322 for (UITouch *touch in touches) {
315- if (isFingerDown && touch == _touchState.touch ) {
323+ // touchSet workaround for SpriteKit bug #15490329
324+ if (isFingerDown && (touch == _touchState.touch || [_touchSet containsObject: touch])) {
325+ _touchSet = Nil ;
316326 isFingerDown = NO ;
327+
317328 CGPoint location = [touch locationInNode: self ];
318329 CGPoint absoluteLocation = [touch locationInNode: self .scene];
319330 _touchState.touchDelta = skpSubtract (absoluteLocation, _touchState.absoluteLocation );
@@ -360,7 +371,9 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
360371 }
361372
362373 for (UITouch *touch in touches) {
363- if (isFingerDown && touch == _touchState.touch ) {
374+ // touchSet workaround for SpriteKit bug #15490329
375+ if (isFingerDown && (touch == _touchState.touch || [_touchSet containsObject: touch])) {
376+ _touchSet = Nil ;
364377 isFingerDown = NO ;
365378
366379 if (_touchState.isDragging ) {
0 commit comments