Xcode 7 - Incompatible block pointer types

后端 未结 1 1492
不思量自难忘°
不思量自难忘° 2021-01-18 13:57

This code worked fine in Xcode 6, but now won\'t compile in Xcode 7. Any ideas how to fix and why this is an issue in Xcode 7?

Incompatible block poin

相关标签:
1条回答
  • 2021-01-18 14:47

    Several interfaces seem to have changed with iOS9 / Xcode7. In that case you most easily fix it, by typing [self.children enum, then press Ctrl+Space and select the appropriate method from the list. This will give you a code fragment with the new block pointer type and you can move the code in there.

    The result would be this: (node was obj after autocompletion, I just renamed it)

    [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);
    }];
    
    0 讨论(0)
提交回复
热议问题