You need to define the method in the target. Since you set the target as ‘self’, then yes that same object needs to implement the method. But you could have set the target to anything else you wanted.
userInfo is a pointer that you can set to any object (or collection) you like and that will be passed to the target selector when the timer fires.
EDIT: … Simple Example:
Set up the timer:
NSTimer* timer = [NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(handleTimer:)
userInfo:@"someString" repeats:NO];
and implement the handler in the same class (assuming you’re setting the target to ‘self’):
- (void)handleTimer:(NSTimer*)theTimer {
NSLog (@"Got the string: %@", (NSString*)[theTimer userInfo]);
}