NSLog: ошибка потока - PullRequest
       0

NSLog: ошибка потока

0 голосов
/ 09 января 2012

Ошибка в NSLog:

*** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[Document myTcpClient])

код:

-(void) myTcpStart: (NSButton*) button{   
    //need threads for the following
    thread_Client = [[NSThread alloc] initWithTarget:self selector:@selector(myTcpClient) object:nil];
    thread_Display = [[NSThread alloc] initWithTarget:self selector:@selector(displayData) object:nil];

    [thread_Client start];
    [thread_Display start];

    [textField1 setStringValue:@"waiting for threads to run"];
}


-(void) myTcpStop: (NSButton*) button{   
    //need threads for the following

    //[thread_Client cancel];
    //[thread_Display cancel];
}

-(void) displayData{
    while(1){   
        [textField1 setStringValue:[NSString stringWithFormat:@"%d %d %f", j, i, genValue]];
        j++;
    }
}

-(void) myTcpClien{
    //some code
}

заголовочный файл:

#import <Cocoa/Cocoa.h>

@interface Document : NSDocument
{
    NSTextField *textField1;
    int i;
    int j;
    double genValue;
    NSWindowController *bController;
    NSThread *thread_Client;
    NSThread *thread_Display;
}

-(void) myTcpClient;
-(void) displayData;

-(void) myTcpStart: (NSButton*) button;
-(void) myTcpStop: (NSButton*) button;

@end

1 Ответ

2 голосов
/ 09 января 2012

Вы забыли T в реализации myTcpClient.Снова, когда вы видите эти сообщения, проверьте ваш код на наличие орфографических ошибок.

Изменение:

- (void)myTcpClien { /* ... */ }

Кому:

- (void)myTcpClient { /* ... */ }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...