Chris
Chris

Reputation: 27384

respondsToSelector failing

I have an XML callback selector that seems to fail at the respondsToSelector test and I am not sure why. Why is the call failing?

The callback is set like so:

[handler setXMLCallBackDelegate:self :@selector(gotXMLCallback)];

The callback is defined like so (in calling class):

-(void)gotXMLCallback:(id)sender{
    NSLog(@"CALLBACK YAY");
}

And the callback is called using this code (from within handler):

if (gotXMLCallback && gotXMLCallbackSelector && [gotXMLCallback respondsToSelector:gotXMLCallbackSelector]) {
    (void) [gotXMLCallback performSelector:gotXMLCallbackSelector withObject:self];
}

Upvotes: 0

Views: 260

Answers (2)

whtlnv
whtlnv

Reputation: 2207

To stablish a selector you should call it

[gotXMLCallback performSelector:@selector(gotXMLCallbackSelector:) withObject:self];    

Upvotes: 0

omz
omz

Reputation: 53551

The colon is part of the selector, so it should be @selector(gotXMLCallback:).

Upvotes: 2

Related Questions