iOS 9 Spritekit 双击在 iPhone 6S 上不工作

iOS 9 Spritekit Double Tap Not Working on iPhone 6S

我制作 SpriteKit 游戏已有一段时间了。它是一种纸牌游戏,允许双击纸牌精灵以获得特定行为。现在我们在 iOS 9,双击在 iPhone 6s 上根本不起作用。在 iOS8,所有设备上工作正常。

在我的 SKScene 中,我使用 touchesBegan 方法检测点击:

-(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");
    }
}

iOS9 或 6s(3d 触摸?)有什么新的东西需要现在为 SpriteKit 游戏实现吗?

我想指出,这在 iPhone 6s 模拟器中工作正常,但在实际设备上却不行。

此外,touch.tapCount 将报告 3、4、5、6、7 等点击,但完全跳过第二次点击。

好的,所以,双击可以正常工作。在 iPhone 6s 上,游戏虽然通过 skView.showsFPS = YES; 报告 60 fps,但 运行 非常滞后。我刚刚发现,如果我慢慢点击,我可以让水龙头工作,就像在第一次和第二次点击之间等待整整一秒钟。

现在开始了解为什么这款游戏在此设备上运行速度如此之慢。它甚至不是 iOS 9 问题,因为游戏在我的 5s 上运行得很好 iOS 9.

根据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.

所以如果这个问题可能是由touchMoved引起的。