I'm working on a Cocoa app.
I would like to catch all keyboard events that are not being handled by any responder, and report them to Google Analytics.
For this purpose, I would like to set a custom NSResponder
that implements keyDown:
as the next responder of the current last responder.
When and where should I call setNextResponder:
in order to keep my custom class the last responder?
From Apple docs:
If no object is found to handle the event, the last responder in the chain invokes noResponderFor:, which for a key-down event simply beeps. Event-handling objects (subclasses of NSWindow and NSView) can override this method to perform additional steps as needed.