Adding reference image failed in visionos

I am trying the image tracking of ARKit on VisionPro, but there seems to be some problem when adding reference image.
Here is my code:

let images = ReferenceImage.loadReferenceImages(inGroupNamed: "photos")
print("Images: \(images)")
try await appState!.arkitSession.run([imageTracking])

It can successfully print those images, however sometimes it will print the error message like this:

ARImageTrackingRemoteService: Adding reference image <ARReferenceImage: 0x3032399e0 name="chair" physicalSize=(0.070, 0.093)> failed.

When this error message is printed, the corresponding image can not be tracked.
I do not understand why this will happen, because sometimes the image can be successfully added, but other time not, even for the same image. It makes my app not stable.
Besides, there are some other error messages, and I do not know whether it is related:

ARPredictorRemoteService <0x1042154a0>: Query queue is not running.
Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted)

Hello @YaShiho,

I do not see it in your code but assume you are doing something like:

let session = ARKitSession()
let imageTracking = ImageTrackingProvider(
    referenceImages: images
)

That code creates the provider, then this code gets the new tracked images:

if ImageTrackingProvider.isSupported {
    Task {
        try await session.run([imageTracking])
        for await update in imageInfo.anchorUpdates {
            updateImage(update.anchor)
        }
    }
}

Where updateImage is function you'd provide that does something interesting with the anchor.

If you are doing these things then I think this would make a great feedback, especially if you can share details and the images in a small project.

If you do end up filing please post the number back here.

Thanks!

Adding reference image failed in visionos
 
 
Q