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 🥳
Topic:
Media Technologies
SubTopic:
Photos & Camera
Tags: