why does UIImagePickerController.isSourceTypeAvailable(.camera) return true when using the simulator

222 Views Asked by At

why does UIImagePickerController.isSourceTypeAvailable(.camera) return true when using the simulator?

This causes the simulator to crash when trying to access the camera.

1

There are 1 best solutions below

1
Jordan H On

This behavior has changed with recent releases.

With Xcode 14.3.1 running the iOS 16.4 Simulator on my M2 MacBook Air, UIImagePickerController.isSourceTypeAvailable(.camera) returns true. When I present UIImagePickerController with sourceType = .camera, it appears but the viewfinder only shows black. Tapping the shutter and flip camera buttons doesn't do anything. Tapping Cancel dismisses it.

Whether or not this is intentional behavior or a bug only Apple could say. :)

Simulator Screenshot