iPhone:无法识别的选择器错误

时间:2011-06-14 21:58:04

标签: iphone selector nsthread

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

RootViewController的

- (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

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

给出

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

有什么问题?

1 个答案:

答案 0 :(得分:1)

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

另见"Unrecognized selector sent to instance"