繁体   English   中英

使用enumerateChildNodesWithName没有可见的@interface错误?

[英]No visible @interface error using enumerateChildNodesWithName?

我过去一直在运行该项目,没有任何错误,当我尝试使用时,所有突然出现的红色标志都会上升:

-(void)aimRocketLauncher:(CGPoint)location
{
__block CGPoint handleLocation;


[self enumerateChildNodesWithName:@"handle" usingBlock: ^(SKNode *node, BOOL *stop) {

    SKSpriteNode *handle = (SKSpriteNode *) node;

    handle.name = @"handle";

    if(CGRectContainsPoint(handle.frame, location)) {

        handle.position = location;
        handleLocation = location;
    }
}];

[self enumerateChildNodesWithName:@"rocketLauncher" usingBlock: ^(SKNode *node, BOOL *stop) {

    SKSpriteNode *rocketLauncher = (SKSpriteNode *) node;

    CGPoint launcherPosition = rocketLauncher.position;

    CGFloat slope = (handleLocation.y - launcherPosition.y) / (handleLocation.x - launcherPosition.x);
    //NSLog(@"%f", slope);

    CGFloat angle = tan(slope);
    angle *= angle;



    SKAction *rotate = [SKAction rotateToAngle:degToRad(angle + 90) duration:0.05];

    //        if (angle < 270 && angle < 180) {
    //            [rocketLauncher removeAllActions];
    //            [rocketLauncher runAction:rotate];
    //
    //        }





}];

}

不只是这个,而是整个项目。 我尝试撤消和清理该项目。

确切的错误:

ARC语义问题'GameScene'的可见@interface声明选择器'enumerateChildNodesWithName:usingBlock:'

其余的代码是什么都没有关系,因为我知道这是可行的。 当我开始键入[self自动完成时,就会找到它,当我右键单击enumerateChildNodesWithName然后跳转到Definition时,它就在那里。 这表示Sprite Kit已正确导入。 我尝试关闭项目并重新启动Mac,但仍然没有任何反应。

我尝试在另一个类中使用此代码以查看会发生什么。 同样的错误。

我在两个具有类似代码的不同项目中看到的唯一区别是,一个是在Xcode 5中启动的,另一个是在Xcode 6中启动的。

我也不想使用任何sks文件。

。H

#import <SpriteKit/SpriteKit.h>
#import "Settings.h"
#import "TopHud.h"
#import "Hud.h"
#import "Menu.h"
#import <AVFoundation/AVFoundation.h>
#import <Foundation/Foundation.h>

@class Menu;
@class Settings;
@class TopHud;
@class Hud;

@interface GameScene : SKScene
{

}
@end

.m文件的顶部

#import "GameScene.h"
@implementation GameScene

我真的需要解决这个问题,因为它杀死了我很大的整个项目。 我一个人在做。

我将部署目标从8更改为7.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM