AVCaptureSession crashes in iOS 10 simulator

Hello.


Xcode 8 GM. iOS 10 (doesn't matter what simulator). On any simulator I receive an EXC_BAD_ACCESS referencing an AVCaptureSession. For instance, even code as simple as this crashes on the 2nd line:


        let captureSession = AVCaptureSession()
        captureSession.sessionPreset = AVCaptureSessionPresetPhoto // crashes


The tip top of the call stack has:


#0
0x0000000111eebb2f in dispatch_async ()
#1
0x000000011bf45c72 in captureSessionSimulator_postNotificationWithPayload ()
#2
0x000000011bf45727 in captureSessionSimulator_SetConfiguration ()
#3
0x000000010c2ca489 in -[AVCaptureSession _buildAndRunGraph] ()
#4
0x000000010c2c3f98 in -[AVCaptureSession _commitConfiguration] ()


Everything works dandy on a device. Happening in the GM is disheartening (works in Xcode 7/iOS 9). Something I'm missing?

Replies

I have the same issue.

Did you ever figure this out? Having the same issue.

Same problem as me. Using Xcode 8 from Mac App Store.

I can confirm this too, unfortunatelly


Did you file a radar?

This is a known bug in the capture frameworks on iOS 10. It will be fixed in a software update. In the meantime, the workaround would be to conditionalize your AVCapture* code to only run on device. Hopefully everyone on this thread is aware that AVCaptureSession and friends don't actually work in the simulator (even if the crash is fixed). To implement capture features for iOS, you need to do it on your target device(s), where the performance characteristics and supported camera features are very different from the desktop.

As a workaround you can still use an iOS 9.3 Simulator

Has this issue been fixed in Xcode 8.2? Or should I keep using iOS 9.3 simulators?

Has there been a patch for this yet?

Sorry, but the advice "conditionalize your AVCapture* code to only run on device" is useless. If the app is aimed to work with the camera, it is quite difficult to do so. And I have a lot of use cases in the app that can be debugged even with "black frames" from simulator's camera. It is much easier to debug them on simulator than on real device.


P.S.

Still crashing.