Objective c 安装中的线程错误?
我收到一条错误信息:Objective c 安装中的线程错误?,objective-c,Objective C,我收到一条错误信息: 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:@se
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错误消息实际上告诉您这里缺少什么。它说NSThread没有这样的选择器,这意味着您应该查看方法签名,因为您的问题几乎肯定存在,在您的情况下,它确实存在 代码中的错误是选择器中的单词对象。方法签名不使用大写字母O。将其更改为小写即可:
// 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];