iOS 13 : apps with camera AV session freeze :

I have various apps that use the front or back camera and intermittently the capture manager/AV session freezes. This doesn't appear to be a media services reset issue. Even if I detect the interruption and try to restart the session it won't start. I have to go to background-foregound-background-foreground and then try starting the AV session again and then it might work. I've also noticed this in other apps like my Bank of America app when scanning in a check for deposit. I've reached out to Apple filing a bug report but they say they can't reproduce the issue. This has been happening on all versions of iOS 13 up to iOS 13.1.2 on all devices from iPhone 8/X/XS/XS Max/11/11 Pro & 11 Pro Max.


Jun 5, 2019 at 6:49 PM – FB6123417

iOS 13 AVCamCaptureManager and AVCaptureVideoPreviewLayer now stalls for no reason or error.

I also met this problem.I solved it by releasing AVCaptureSession before go to background, and recreate AVCaptureSession when back to foreground. Hope it helps.

I am seeing this in my apps too, and it's very sporadic. An app's AVCaptureSession can show several freezes in a 15 minute period or go hours between freezes. It's affecting my iPhone X and iPhone 11 Pro Max, both on 13.1.2. Putting the app in the background and then bringing it back to the foreground restores the AVCaptureSession every time.


A couple times when this happened, I tapped the shutter button in my app and would see one of these two errors inside the "didFinishProcessingPhoto" method of my AVCapturePhotoCaptureDelegate:


Error Domain=AVFoundationErrorDomain Code=-11803 "Cannot Record"


Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action"


That's what led me to realize that the AVCaptureSession was freezing and not simply the AVCaptureVideoPreviewLayer.

I don't think this will have an effect from what I am seeing, at least not as a cause -- I can see the freezes happening in an app that was never put into the background after it was launched. Launch the app, let it run and eventually the freeze will occur.

Hello,

I am facing same issue. I am using AVcapturesession to scan barcode. In that I simply start session and once barcode will get scan I stop that session. This is working fine till iOS 12. In iOS 13, screen got freeze.Don't know what's the issue.

Is there any one can help me?

Hi,
I am also facing this issue & trying to look into it.

I am getting this error
Code Block language
Capture session runtime error: related decl 'e' for AVError(_nsError: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.})


Right now, try commenting out the all the code where you add or remove Observers to & from NotificationCenter. And then debug the app.

Comment all the code lines which are related to NotificationCenter. & then slowly slowly debug the app and move forward.
Code Block language
NotificationCenter.default.removeObserver(self, name: .AVCaptureDeviceSubjectAreaDidChange, object: currentVideoDevice)
NotificationCenter.default.addObserver(self, selector: #selector(self.subjectAreaDidChange), name: .AVCaptureDeviceSubjectAreaDidChange, object: videoDeviceInput.device)

I will update the answer if I found anything more helpful.
Thanks
iOS 13 : apps with camera AV session freeze :
 
 
Q