why is this error occurring?

my code

func placeObjectAtImageTracking(object: ModelEntity, imageAnchor: ARImageAnchor) -> AnchorEntity {
    let imageAnchorEntity = AnchorEntity(anchor: imageAnchor)
    return imageAnchorEntity
}

in this code, AnchorEntity(anchor: imageAnchor) is occuring error when i changed xcode setting device.

It's fine when I set it to my real phone, but when I change it to the simulator, the following error appears.

No exact matches in call to initializer 

how to solve it?

Answered by arthurfromberlin in 742852022

I think RealityKit is unfortunately not supported in the Simulator, so it can't find the initializer. If you have an Apple Silicon may you could run RealityKit there though via the »My Mac (Designed for iPad)« option.

Accepted Answer

I think RealityKit is unfortunately not supported in the Simulator, so it can't find the initializer. If you have an Apple Silicon may you could run RealityKit there though via the »My Mac (Designed for iPad)« option.

@arthurfromberlin RealityKit is supported in the simulator. You're probably hitting the issue where ARView crashes when getting or setting automaticallyConfigureSession, which is included in the recommended ARView constructor. If you remove it from the constructor and ignore the deprecation warning you should be able to create an ARView.

Hi, I took a look at RealityKit's source, and it looks like this specific initializer is not available in the simulator. You might want to try using AnchorEntity(world:) where you pass in the transform property of the ARAnchor.

why is this error occurring?
 
 
Q