ARKit Plane Detection - Value of type 'ARView' has no member 'session'
You get this error if your build destination is set to a Simulator. You need to select either an Actual Device or Generic iOS Device.
I've banged my head on this a couple of time and now add the following comment
// If the following line fails to compile "Value of type 'ARView' has no member 'session'" // You need to select a Real Device or Generic iOS Device and not a simulator arView.session.run(configuration)
If you use iOS Simulator
for AR app based on Interface Builder Storyboard or if you use iOS SwiftUI Preview
– then you can't implement session-oriented properties and anchoring components for ARView. As you can see there are a lot of errors in this case.
Simulator is chosen in Xcode Active Scheme.
The only way to use session-oriented properties for your AR app is to choose a real iOS or iPadOS device in the Xcode Active Scheme
drop-down menu.
Real Apple device is chosen for build.
The same is true for installGestures() method
iOS Simulator:
Real Device:
I managed to eliminate this problem by using conditional compilation.
#if !targetEnvironment(simulator) return ARView(frame: .zero)#else return UIView(frame: .zero)#endif
The compilation issues stopped, but I will admit that I still have problems with previews. But I think that is more related to code complexity than to this error.