shu223 / iOS-Depth-Sampler

Code examples for Depth APIs in iOS
MIT License
1.17k stars 101 forks source link

AVCaptureDevice+Extension selectDepthFormat parses empty availableFormats which results in fatalError #11

Closed E-Mac27 closed 3 years ago

E-Mac27 commented 3 years ago

Hi,

Thanks for this great repo. I've had a play around with the samples and it seems only the front camera is working properly. The device I am using to run the program is iPhone 11 and my XCode version is 12.2.

When I try to run Real-time Depth and Real-time Depth Mask, I run into a fatal error in AVCaptureDevice+Extension line 39.

I've tried to have a look at it myself but since I'm relatively new to Swift, I've been unable to resolve the problem myself. The availableFormats is always empty which results in the guard failing. I'm not too sure why since the format field is always populated.

Am I doing something wrong?

E-Mac27 commented 3 years ago

Nevermind. I solved it. Its because iPhone 11 uses .builtInDualWideCamera instead of the .builtInDualCamera