Always use notification name globals, not string literals!
What’s wrong with this code? – (void)registerForNotificationsFromTask:(NSTask *)task ( { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidTerminateNotification:) name:@”NSTaskDidTerminateNotification” object:task]; } If you didn’t notice anything wrong, look again. What’s bad about this is that it’s passing a **string literal** instead of a **global variable** for the notification name. The code should really look like this: – (void)registerForNotificationsFromTask:(NSTask *)task […]
Tagged Cocoa, Objective-C, Xcode