Hello,
We are seeing some strange behaviour when using MPRemoteCommandCenter as well as UIKeyCommand in our app on iOS 17.
We are finding that when a UIKeyCommand is trigerred via external keyboard to start playing some music (via our own custom CoreAudio driver), the keyboard becomes unresponsive for a few seconds before UIKeyCommands are triggered again.
Strangely enough, if we comment out all our MPRemoteCommandCenter code, the UIKeyCommands work without going into the unresponsive state for a few seconds.
ie UIKeyCommands:
override open var keyCommands: [UIKeyCommand] {
let commands = [UIKeyCommand(title: String(localized: "__PLAY_STOP__"), action: #selector(shortcutPlayStop(_:)), input: " "),
UIKeyCommand(title: String(localized: "__PAUSE__"), action: #selector(shortcutPause(_:)), input: "."), /** etc **/]
commands.forEach { $0.wantsPriorityOverSystemBehavior = true }
return commands
}
and MPRemoteCommands:
MPRemoteCommandCenter.shared().playCommand.addTarget { [weak self] _ in
self?.doStuff()
// etc
return .success
}
Note this issue did not occur prior to iOS17 🤨
Any ideas what could be going on?
Thank you!