objective-cnsnotificationkiwi

Kiwi spying on multiple NSNotifications


I am currently spying on postNotification like this

__block KWCaptureSpy *notificationSpy = [[NSNotificationCenter 
defaultCenter] captureArgument:@selector(postNotification:) atIndex:0];

The problem is I have multiple notifications with different notification names. How do I access the spy's argument for different notification.

For instance say I have Notification1 and Notification2 the spy argument captures Notification1 but I'm not able to capture the Notification2.

Any ideas of how this can be done?


Solution

  • Two approaches come into my mind:

    As a side note, you don't need to decorate the notifications variable with __block, as you don't need to change the content of that variable (i.e. the pointer value).