2012-01-08 76 views
0

我得到的ErrorMessage:安装程序中的线程错误?

Automatic Reference Counting Issue 
Receiver type 'NSThread' for instance message does not declare a method with selector 'initWithTarget:selector:Object:' 

此代码:

NSThread *thread_Client = [[NSThread alloc] initWithTarget:self selector:@selector(myTcpClient:) Object:nil]; 

为什么......我缺少什么?

thx

回答

1

错误信息实际上告诉你你在这里错过了什么。它说,NSThread有没有这样的选择,这意味着你应该看看该方法的签名,因为你的问题是,几乎可以肯定是存在的(和你的情况,它是)。

在你的代码中的错误是在选择这个词对象。该方法的签名不使用资本Ø。更改为小写,你会被罚款:

// Method signatures are case sensitive, so: 
// -initWithTarget:selector:Object: and -initWithTarget:selector:object are different methods 
[[NSThread alloc] initWithTarget:self selector:@selector(myTcpClient:) object:nil];