Search code examples
iosiphonexamarin.iosaugmented-realityarkit

AR Kit 3: SupportsFrameSemantics() is returning false on supported iOS device


I am using an iPhone 11 using iOS 13.2.3.

Xcode 11.2.1

Xamarin.iOS V13.6.0.12

The person segmentation does work successfully regardless of API call saying it isn't supported which is strange. I need to be able to detect if it's supported per device to handle devices that don't support arkit 3 human occulsion.

Does anyone else have the same problem?

    public override void ViewDidLoad()
    {

        base.ViewDidLoad();

        // All returning false
        Debug.WriteLine("Person Segmentation Supported: " + ARWorldTrackingConfiguration.SupportsFrameSemantics(ARFrameSemantics.PersonSegmentation));
        Debug.WriteLine("Person Segmentation Depth Supported: " + ARWorldTrackingConfiguration.SupportsFrameSemantics(ARFrameSemantics.PersonSegmentationWithDepth));
        Debug.WriteLine("Body Detection Supported: " + ARWorldTrackingConfiguration.SupportsFrameSemantics(ARFrameSemantics.BodyDetection));

    }

    [Export("renderer:didAddNode:forAnchor:")]
    public void DidAddNode(ISCNSceneRenderer renderer, SCNNode node, ARAnchor anchor)
    {
        // Returns false
        Debug.WriteLine("Supported? " + ARWorldTrackingConfiguration.SupportsFrameSemantics(ARFrameSemantics.PersonSegmentationWithDepth));

        // Create AR config with Person Segmentation added
        var configuration = new ARWorldTrackingConfiguration
        {
            PlaneDetection = ARPlaneDetection.None,
            LightEstimationEnabled = true,
            FrameSemantics = ARFrameSemantics.PersonSegmentationWithDepth
        };

        // Runs the session and the feature works on iPhone 11 regardless of SupportsFrameSemantics(ARFrameSemantics.PersonSegmentationWithDepth) == false
        ARView.Session.Run(configuration, new ARSessionRunOptions());
    }

Solution

  • https://github.com/xamarin/xamarin-macios/issues/9271 I've opened up an issue ticket on xamarin's github. See Whitneys comment for a work around, she has opened a PR also so expect this to be included in an update soon.