Search code examples
iosbackgrounduiresponder

What does the responder chain look like for an application in the background?


If an audio application is configured to play audio in the background, you can set it up to receive remote control events. Apple's docs describe what is necessary and how to set this up. One of the key aspects is to make sure that the object receiving and responding to the remote control events can (and will) become first responder.

What does the responder chain looks like when an application is in the background. I am familiar with the responder chain and how it operates, but how do I know what objects are part of the responder chain and which object becomes the first responder when an application is in the background?


Solution

  • Since the application is in the background, the key and main window are nil so they aren't included in the responder chain. The responder chain then consists of only the application instance and its delegate.

    This is a problem for me since I actually want the window (document) to handle actions in the background pretty similar to what you're trying to do. I was able to get around this by using NSResponder's tryToPerform:with:.