Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Interface 对于';没有可见的@界面;NSThread';声明选择器';启动';_Interface_Nsthread_Visible - Fatal编程技术网

Interface 对于';没有可见的@界面;NSThread';声明选择器';启动';

Interface 对于';没有可见的@界面;NSThread';声明选择器';启动';,interface,nsthread,visible,Interface,Nsthread,Visible,好的,我已经做了两个小时了 我可以在模拟器中运行以下代码行,但我无法在设备上编译,我不知道为什么 我一直收到编译错误“No visible@interface for'NSThread”声明选择器“start”。错误发生在[t start]行 代码如下: @interface FMThread : NSObject { @private NSCondition *waitCondition; } @property (copy) void (^block)(void); + (void)

好的,我已经做了两个小时了

我可以在模拟器中运行以下代码行,但我无法在设备上编译,我不知道为什么

我一直收到编译错误“No visible@interface for'NSThread”声明选择器“start”。错误发生在[t start]行

代码如下:

@interface FMThread : NSObject {
@private
    NSCondition *waitCondition;
}
@property (copy) void (^block)(void);
+ (void)runInSeparateThread:(void (^)(void))block;
@end

@implementation FMThread

+ (void)runInSeparateThread:(void (^)(void))block
{
    FMThread *thread = [[FMThread alloc] init];
    thread.block = block;
    thread->waitCondition = [[NSCondition alloc] init];

    [thread->waitCondition lock];

    NSThread *t = [[NSThread alloc]initWithTarget:thread selector:@selector(threadMain) object:nil];
    [t start];
    [thread->waitCondition wait];
    [thread->waitCondition unlock];
}

- (void)threadMain
{
    @autoreleasepool {
        self.block();

        [waitCondition broadcast];
    }
}

@end
任何帮助都将不胜感激。我想我是坐在靠近树木的地方看福勒斯特山的