AR Face Tracking Tutorial for iOS: Getting Started | Ray Wenderlich

In this tutorial, you’ll learn how to use AR Face Tracking to track your face using a TrueDepth camera, overlay emoji on your tracked face, and manipulate the emoji based on facial expressions you make.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/195159/ar-face-tracking-tutorial-for-ios-getting-started

Hello, Yono

Thanks for learning your tutorial. I’m running through your tutorial.
I just would like to make sure that, should I use this?

func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) → SCNNode? {

    // Ensure the Metal device used for rendering is not nil.
    guard let faceAnchor = anchor as? ARFaceAnchor,
         let device = MTLCreateSystemDefaultDevice() else {
        return nil
    }


}

In your code, I met an error of Value of type ‘ARSCNView?’ has no member ‘device’. So I migrate it as above by inheriting MTLDevice.

Please check it once again! Is it worked?

Best Regards,
Jinho

P.S my OS is Mac OS Mojave 10.14 developer version 9 and Xcode 10 beta 6, Swift 4.2 version.

Hi Jinho,

You might be getting the Value of type ‘ARSCNView?’ has no member ‘device’ error if you build against an iOS Simulator instead of a device.

The device member only exists when building against either a real device or the Generic iOS Device scheme.

Can you try that and see if the error goes away?

Hi Yono, Thanks for your comment! Yes, the error went away when I set up a real device!