开发者

iPhone: unrecognized selector error

开发者 https://www.devze.com 2023-03-13 04:57 出处:网络
I\'m threeaing some tasks like this : RootViewController - (void)viewDidLoad { [NSThread detachNewThreadSelector:@selector(findSomething) toTarget:self withObject:nil];

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 in开发者_JAVA技巧stance 0x5888080

What is the problem ?


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".

0

精彩评论

暂无评论...
验证码 换一张
取 消