iOS 9 Spritekit Double Tap Not Working on iPhone 6

2019-06-27 12:43发布

I have been building a SpriteKit game for a while now. Its a card game that allows double-tap on card sprites for specific behaviors. Now that we're in iOS 9, double taps do not work at all on iPhone 6s. Works fine on iOS8, all devices.

In my SKScene, i'm using the touchesBegan method to detect taps:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    CGPoint touchLocation = [touch locationInNode:self];

    if(touch.tapCount==2) {
        NSLog(@"double-tap, but not for iPhone 6s");
    }
}

Is there anything new with iOS9 or the 6s specifically (3d touch?) that needs to be implemented now for SpriteKit games?

I would like to note that this works fine in the iPhone 6s simulator, but it does not on the actual device.

Also, touch.tapCount will report 3, 4, 5, 6, 7 etc. taps, but completely skips just the second tap.

2条回答
疯言疯语
2楼-- · 2019-06-27 13:15

According to https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-9.1/

UIKit
Note
On 3D Touch capable devices, touch pressure changes cause 
touchesMoved:withEvent: to be called for all apps running on iOS 9.0. 
When running iOS 9.1, the method is called only for apps 
linked with the iOS 9.0 (or later) SDK.

Apps should be prepared to receive touch move events 
with no change in the x/y coordinates.

So if this problem can be caused by touchMoved.

查看更多
Bombasti
3楼-- · 2019-06-27 13:18

Ok, so, double taps ARE working, sort of. On iPhone 6s, the game, though reporting 60 fps through skView.showsFPS = YES;, is running very laggish. I just discovered that I can get the taps to work if I tap slowly, as in wait one whole second between the first and second tap.

Now onto discovering why this game is so slow on this device. Its not even an iOS 9 issue because the game works just fine on my 5s w/ iOS 9.

查看更多
登录 后发表回答