I have the following method:
- (void) broadcastSelector:(SEL)selector {
for (id listener in [self listeners]) {
if([listener respondsToSelector:@selector(selector)]) {
[listener performSelector:@selector(selector)];
}
}
}
And I'm calling it in the following way:
[self broadcastSelector:@selector(onLoginRequestStarted)];
And that doesn't work. My confusion is the following:
If I hardcode the selector in the method, like the following:
- (void) broadcastSelector:(SEL)selector {
for (id listener in [self listeners]) {
if([listener respondsToSelector:@selector(onLoginRequestStarted)]) {
[listener performSelector:@selector(onLoginRequestStarted)];
}
}
}
everything works fine. So I'm assuming something is wrong with how I call the method, or how I define the parameter.