iPhone: unrecognized selector error

北城余情 提交于 2019-12-20 05:53:26

问题


I'm threeaing some tasks like this :

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];
}

gives

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

What is the problem ?


回答1:


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.

See also "Unrecognized selector sent to instance".



来源:https://stackoverflow.com/questions/6350617/iphone-unrecognized-selector-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!