4

This line of code is the problem I got today (macOS app):

NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];

After I update Xcode, the system is alway got me empty devices array.

The thing is, the old projects(created before the update) work as expected.

What's going on here...?

Does anyone has the same problem?

------------UPDATE------------

I found this not just happened to my mac, also on the company's.

And it does affect my work.

alseether
  • 1,889
  • 2
  • 24
  • 39
scchn
  • 315
  • 3
  • 16

2 Answers2

4

I think I found the answer...

Target Settings / Capabilities / App sandbox / Hardware

enter image description here

scchn
  • 315
  • 3
  • 16
  • 1
    AHA! Thank you! Note that “microphone” is what give you permissions for audio inputs; if only “camera” is checked, you’ll still get an empty list for `AVCaptureDevice.devices(for: .audio)`. – Paul Cantrell Dec 07 '18 at 15:36
0

This problem only happens on the Mac OS 10.13, Mac OS 10.12 is normal. I have the same problem, and there's no solution yet. AVCaptureDevice not found video device, i think it's apple that added permissions on the camera on 10.13.