AR Foundation TryAcquireLatestCPUImage broken

[Repost from IOS discussion, I think this is the right place.]
The following code results in the camera preview freezing on IOS. I’ve reliably narrowed it down to using the function TryAcquireLatestCpuImage(out XRCpuImage image). The cameraManager is present so this isn’t the problem.
Commenting TryAcquireLatestCpuImage results in the preview working again. Also tried turning of multithreaded rendering and putting it in the Update() function.
Also can’t see anything or any errors in the logs.

Also the documentation at https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.0/manual/features/camera.html#accessing-the-device-camera-image-on-the-cpu contains an error. It should be “frameReceived” instead of “cameraFrameReceived”.

Platforms:
Unity 2021.3.14f
ARKit 5.0.3
AR Foundation 5.0.3
Xcode 14.1
iPad Pro 3th gen IOS 16.2

using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;

public class TestXRCpuImage : MonoBehaviour
{
    public ARCameraManager cameraManager;
   
    void OnEnable()
    {
        cameraManager.frameReceived += FrameChanged;
    }

    void OnDisable()
    {
        cameraManager.frameReceived -= FrameChanged;
    }

    private void FrameChanged(ARCameraFrameEventArgs args){
        if (!cameraManager.TryAcquireLatestCpuImage(out XRCpuImage image))
            return;
    }

}
1 Like

Note: I think it might be related to the IOS 16 update. I had it working before I updated to IOS 16.

1 Like

We have answered this question here: [Bug] AR Foundation TryAcquireLatestCPUImage broken (IOS 16.2) · Issue #1057 · Unity-Technologies/arfoundation-samples · GitHub

1 Like

Documentation needs to be updated

https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.1/manual/features/Camera/image-capture.html