"Microphone Recording Fails When Launching App from Shortcut (Error Code 561015905)"

I'm experiencing an issue with microphone recording in my app when launched from a Shortcut. The app works correctly when launched directly, but launching it through the Shortcut results in the "Session activation failed" error (code 561015905).

Here's what I've done so far:

My app has microphone permission granted. The startRecording function sets the audio session category to .playAndRecord. I've implemented error handling within startRecording to catch the error code. The Shortcut workflow includes an action to launch the app (no explicit microphone permission request within the Shortcut).

xcode version - 15.2 iphone ios version - 17.4.1

Answered by Engineer in 791149022

You cannot trigger an audio recording from the Shortcuts app. Your app needs to be in the foreground before the user can start recording audio.

Consider overriding the openAppWhenRun property to return true in your implementation of the AppIntent protocol. This allows you to define the presentation style for the intent such that your app is brought to the foreground when the user intends to record audio.

Accepted Answer

You cannot trigger an audio recording from the Shortcuts app. Your app needs to be in the foreground before the user can start recording audio.

Consider overriding the openAppWhenRun property to return true in your implementation of the AppIntent protocol. This allows you to define the presentation style for the intent such that your app is brought to the foreground when the user intends to record audio.

"Microphone Recording Fails When Launching App from Shortcut (Error Code 561015905)"
 
 
Q