3 Replies
      Latest reply on Mar 18, 2019 2:20 PM by gchiste
      rascione Level 1 Level 1 (0 points)

        I'm trying to do something with ARFaceTracking but on PlaygroundBook it doesn't work.. But I have an iPad Pro. I really cannot understand where is the mistake.. I see only a black screen on the right while I should see the front camera


        This is my simple code:


        import PlaygroundSupport

        import ARKit




        var sceneView: ARSCNView! = ARSCNView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))

        let configuration = ARFaceTrackingConfiguration()


        PlaygroundPage.current.needsIndefiniteExecution = true

        PlaygroundPage.current.liveView = sceneView


        • Re: iPad Pro issues with playground ARFaceTracking
          dennissimeau Level 1 Level 1 (0 points)

          Hey Rascione,


          The main problem that I figured out why it wouldn't work with me, is that the ARSCNView, which is a view for displaying AR experiences and that uses the camera, was not set to the view of the class itself.


          //Set a global variable of ARSCNView
          var sceneView = ARSCNView!
          //Set sceneView to its own view
          self.view = sceneView


          I would recommend to uses in the form of classes. So make a class like FaceTrackViewController or something and handle all your code in this way. You can also easier use inheritance of UIViewController and implement the delegate methods of ARSCNViewDelegate and ARSCNViewSession.


          For other people reading this post:


          This is the point where my camera works just fine, but the renderer methods (nodeFor anchor etc...) don't get called. Yes, I set the delegates of the earlier mentioned interfaces to self.

          • Re: iPad Pro issues with playground ARFaceTracking
            dennissimeau Level 1 Level 1 (0 points)

            With some help of some friends on the interwebs, I got a possible answer to why it doesn't work. Apparently Swift Playgrounds uses iOS 12.0 SDK, and TrueDepth support was added in 12.1. So unless Apple updates the playgrounds app, I think we're out of luck of using the FaceTracking API.

            • Re: iPad Pro issues with playground ARFaceTracking
              gchiste Apple Staff Apple Staff (60 points)

              See this forum post for some clarification on the issue: https://forums.developer.apple.com/thread/114609