Xcode 7 - 不兼容的块指针类型

Xcode 7 - Incompatible block pointer types

此代码在 Xcode 6 中运行良好,但现在无法在 Xcode 7 中编译。 关于如何解决以及为什么这是 Xcode 7 中的问题的任何想法?

Incompatible block pointer types sending 'void (^)(SKSpriteNode *__strong, NSUInteger, BOOL *)' to parameter of type 'void (^ _Nonnull)(SKNode * _Nonnull __strong, NSUInteger, BOOL * _Nonnull)'

[self.children enumerateObjectsUsingBlock:^(SKSpriteNode * node, NSUInteger idx,BOOL *stop)
{
    float parallaxRatio = [(NSNumber *)node.userData[@"ParallaxRatio"] floatValue];
    CGPoint childVelocity = CGPointMultiplyScalar(self.velocity, parallaxRatio);
    CGPoint offset = CGPointMultiplyScalar(childVelocity, deltaTime);
    node.position = CGPointAdd(node.position, offset);
}];

几个界面似乎随着 iOS9 / Xcode7 发生了变化。在这种情况下,您最容易修复它,方法是键入 [self.children enum,然后按 Ctrl+Space 和 select 列表中的适当方法。这将为您提供具有新块指针类型的代码片段,您可以将代码移入其中。

结果是这样的:(node 在自动完成后是 obj,我只是重命名了它)

[self.children enumerateObjectsUsingBlock:^(SKNode * _Nonnull node, NSUInteger idx, BOOL * _Nonnull stop) 
{
    float parallaxRatio = [(NSNumber *)node.userData[@"ParallaxRatio"] floatValue];
    CGPoint childVelocity = CGPointMultiplyScalar(self.velocity, parallaxRatio);
    CGPoint offset = CGPointMultiplyScalar(childVelocity, deltaTime);
    node.position = CGPointAdd(node.position, offset);
}];