Help - Background Audio Not Working on iOS

SDK Version: 42
Platform: iOS

As per the docs:

I’ve added the following:

await Audio.setAudioModeAsync({
        allowsRecordingIOS: true,
        playsInSilentModeIOS: true,
        staysActiveInBackground: true,
        interruptionModeIOS: INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS
      }); 

and updated app.json:

"expo": {
  ...
  "ios": {
      ...
      "infoPlist": {
        "UIBackgroundModes": [
          "audio"
        ]
      }
    },
}

I am ejected in the Bare Workflow, and I re-built the app using expo start:ios

However, audio recording is cancelled whenever I navigate out of the application.

Am I missing something here?

Cheers!

Hey @wrsulliv, running expo start starts metro and generates/serves your JS bundle. You’ll need to actually build a new binary via eas build. See Creating your first build - Expo Documentation

Cheers,
Adam

Whoops I meant I ran expo run:ios which is documented to build a bare app here: Adding custom native code - Expo Documentation

I was able to resolve the issue by opening the app in XCode and manually adding the “Background” Capability.

Without that, the app would cancel the recording session upon navigating away from the app.

I want to avoid directly editing the build files, because as I understand it, the Expo configuration plugin system may edit them.

My guess is, there’s a mismatch between what XCode is doing and what Expo CLI is doing when it interprets app.json.

I’m not sure, but perhaps something like that =)

Thank You,
Will

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.