iPhone:无法识别的选择器错误 [英] iPhone: unrecognized selector error

查看:182
本文介绍了iPhone:无法识别的选择器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些像这样的任务:

I'm threeaing some tasks like this :

- (void)viewDidLoad {
[NSThread detachNewThreadSelector:@selector(findSomething) toTarget:self withObject:nil];
}

- (void) findSomething {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
doMoreThings
[pool release];
}

- (void) doMoreThings {
  doMoreMoreMoreThings on different objects
}

- (void) foundSomething:(NSFoundThing*)foundObj {
    do your stuff
}



oneObject



oneObject

- (void) doMoreMoreMoreThings {
   do things
[self performSelectorOnMainThread:@selector(foundSomething:) withObject:thingFound waitUntilDone:NO];
}



给出



gives

-[KMLParser foundSomething:]: unrecognized selector sent to instance 0x5888080

问题是什么?

推荐答案

线程无关紧要。你没有向我们展示的一些代码是这样做的,所以你将 foundSomething:选择器发送给一个不处理该消息的对象。将邮件路由到处理邮件的对象,问题就会消失。

The threading is irrelevant. Some of the code you're not showing us is making it so you are sending the foundSomething: selector to an object that doesn't handle that message. Route the message to an object that does handle it, and your problem will go away.

另请参阅无法识别的选择器已发送到实例

这篇关于iPhone:无法识别的选择器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆