Significant Uptick in AVCaptureSessionWasInterrupted (Reason 4) Leading to Camera Black Screen and AVError Code -11803

In the latest production release of our iOS app (deployed via the App Store), we’ve observed a significant increase in AVCaptureSessionWasInterrupted notifications where the interruption reason has a rawValue of 4. The session does not automatically recover, even after returning from background or deleting/reinstalling the app. An employee ran into this and was able to get a recording. We see the below error when attempting to take photos.

"Error Domain=AVFoundationErrorDomain Code=-11803 \"Cannot Record\" UserInfo={AVErrorRecordingFailureDomainKey=3, NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}",
}

This interruption causes the camera preview to remain black, and any attempt to capture an image results in a failure with the following error:

Some questions from our team:

  • What common system conditions or foreground app behaviors can cause .videoDeviceNotAvailableWithMultipleForegroundApps (reason 4) to become persistent? Our teams under is under the impression the interruption reason 4 is mostly associated with iPad and PiP, but neither of these are true in the logs we see.
  • Is manual recovery of the session required?
  • Is there a recommended strategy to detect that the session is unrecoverable and gracefully notify the user or rebuild the session?
  • Is there an instrument(s) in XCode you would recommend when trying to evaluate the increase in reason 4?

Best,

Ben

I believe this may have been closely aligned with the 18.4.1 release. Below is a visual of the count over time by OS.

Did you figure this out? We are also getting reports from some of the users of our camera app that the preview remains black and they are unable to capture photos (iOS users, not sure if any iPad users had the issue as well). The only way to fix the issue is a full device reboot, restarting/re-installing the app doesn't fix the issue (it's like iOS has blacklisted the app and won't let it start a new session until the device is rebooted).

Hello! I had the same issue, and I believe I've found a solution. After some digging, I came across the following information:

AVCaptureSession.InterruptionReason with rawValue: 4 corresponds to videoDeviceNotAvailableWithMultipleForegroundApps

The explanation found in Xcode about the error is:

“An interruption caused when the app is running in a multi-app layout, causing resource contention and degraded recording quality of service. Given your present AVCaptureSession configuration, the session may only be run if your app occupies the full screen.”

According to the Apple Developer documentation:

“If your capture session configuration disallows accessing the camera while multitasking, the system interrupts it with this reason when a user switches to a multitasking mode like Split View. The system doesn’t interrupt your capture session with this reason if isMultitaskingCameraAccessEnabled is true.”

So I decided to try setting isMultitaskingCameraAccessEnabled = true, but to do that I first had to enable the Multitasking Camera Access capability in my project settings.

After adding the capability and setting session.isMultitaskingCameraAccessEnabled = true (before starting the session), my app started working just fine again 🥳

Significant Uptick in AVCaptureSessionWasInterrupted (Reason 4) Leading to Camera Black Screen and AVError Code -11803
 
 
Q