Skip to content

Instantly share code, notes, and snippets.

@0xced
Last active February 18, 2020 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xced/6b9cc68afe620d8a436af6940cb0ce23 to your computer and use it in GitHub Desktop.
Save 0xced/6b9cc68afe620d8a436af6940cb0ce23 to your computer and use it in GitHub Desktop.
Answer to "No depthData with iPhone X, iPhone XS is fine" https://stackoverflow.com/questions/60230760/no-depthdata-with-iphone-x-iphone-xs-is-fine as a gist since my answer was deleted on the grounds that a link to some other code is not an answer

I recently worked on a project where I had to access the depth data on an iPhone X. I forked the ALCameraViewController project and created a depth branch. You can clone my repository and checkout the depth branch. Then run the demo app and take a picture with the camera.

Put a breakpoint on line 148 of the CameraView.swift file and check if photo.depthData is nil in the photoOutput(_, didFinishProcessingPhoto, error) callback. For me it was never nil on an iPhone X.

If it's not nil then you can compare the code and understand the difference. It it's nil then it's probably a bug in iOS itself and I'd suggest you to update to the latest iOS version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment