<分区>
<分区>
我收到以下错误。
程序中出现意外的“@”。
我的代码如下:
SKTexture* eyeTexture1 = [SKTexture textureWithImageNamed:@"eye1"];
eyeTexture1.filteringMode = SKTextureFilteringNearest;
SKTexture* eyeTexture2 = [SKTexture textureWithImageNamed:@"eye2"];
eyeTexture2.filteringMode = SKTextureFilteringNearest;
SKAction* flap = [SKAction repeatActionForever: [SKAction animateWithTextures:@[eyeTexture1, eyeTexture2] timePerFrame:0.2]];
_eye = [SKSpriteNode spriteNodeWithTexture:eyeTexture1];
[_eye setScale:2.0];
_eye.position = CGPointMake(self.frame.size.width / 4, CGRectGetMidY(self.frame));
[_eye runAction:flap];
}
@end //this is where the error occurs.
我已经检查了这里的其他答案,但它们没有解决我的问题。 谢谢
编辑:作为回应,代码在@implementation 中,由于堆栈溢出的“更多代码,更多细节”问题,我无法添加更多代码。有一个大括号打开它。
最佳答案
您的 .m 文件顶部需要有一个匹配的“@implementation
”。
例如:
@implementation MyGameCode
…
…
…
@end
关于ios - 错误 : Unexpected '@' in program,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22290856/
相关文章:
ios - 在 Swift 中使用 XMLParser 解析特定标签并保存为字符串
上传到 App Store 时 Xcode 出错 : "No suitable application records were found"
ios - 更新 Swift 语言 : Type 'NSCoder' has no member 'plain'
ios - 谓词中的逻辑运算符是否与 NSFetchRequest 短路?
ios - 是否有可能在 iOS 罗盘航向中获得低于度数的精度?
iphone - 当我的同事更改代码并将其提交到存储库时,我可以看到代码,但 xCode 编译时就好像他的贡献不存在一样