Cannot Start Audio Playback from Interactive Widget (iOS 17)

I want to be able to start/stop audio from my interactive widget.

But when I try to start playback with my AppIntent, I get the error,

ATAudioSessionClientImpl.mm:281 activation failed. status = 561015905

This indicates the app isn't set up properly for background audio, but it has Audio, AirPlay, and Picture in Picture checked in Background Modes.

Is this an intentional limitation of 3rd party widgets?

The Apple Music widget is able to start and stop audio without the app being in the foreground. Can third party apps do it too?

Answered by billybobyourmom in 763094022
Accepted Answer

For those still struggling with this - make sure that your widget code has target membership for your widget extension AND your iOS app. This is required otherwise the background audio capability doesn't work. What's frustrating is it works on the simulator even if the iOS app isn't included in the target membership. If you run on a real device you'll get the error. Make sure you include both targets!!

Cannot Start Audio Playback from Interactive Widget (iOS 17)
 
 
Q