I assume that you've typed your question incorrectly and you'd meant to write addObserver:selector:name:object:
, instead of addObserver:selector: postNotificationName:object:
(such method doesn't exist).
In the documentation of - (void)addObserver:(id)notificationObserver selector:(SEL)notificationSelector name:(NSString *)notificationName object:(id)notificationSender
we can read:
notificationSender
The object whose notifications the observer wants to receive; that is, only notifications sent by this sender are delivered to the observer. If you pass nil, the notification center doesn’t use a notification’s sender to decide whether to deliver it to the observer.
So in your case, as you're passing object:nil
in postNotificationName:object:
, you also have to set object:nil
in addObserver:selector:name:object:
.
According to the documentation you also should replace the method doStuff
with:
- (void)doStuff:(NSNotification *)notification
and use @selector(doStuff:)
in addObserver:selector:name:object:
.