iPhone:无法识别的选择错误

问题描述:

我threeaing一些这样的任务:iPhone:无法识别的选择错误

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 

问题是什么?

线程无关紧要。您没有向我们展示的部分代码正在实现,因此您要将foundSomething:选择器发送给不处理该消息的对象。将消息路由到处理它的对象,并且问题将消失。请参阅"Unrecognized selector sent to instance"

+0

在显示的代码中发送了哪个对象是我的选择器? – Oliver 2011-06-14 22:04:59

+0

** oneObject **部分中的哪个对象是'self'。 – 2011-06-14 22:06:21

+0

我会读一些关于线程的更多内容,但只是一个问题:如果我在oneObject类中有一个foundSomething方法会发生什么?在线程方面会发生什么:我已经有了一个主要的thjread,其中有东西跑进去...... – Oliver 2011-06-14 22:10:04