Hello
Ready some post and documentation.
If finally tryied to launch an ARView in nonAR mode.
Here is the documentation I read:
https://developer.apple.com/documentation/realitykit/arview/3340492-init
So Given a fresh new Xcode project setup using Augmented Reality App configuration for iOS default.
I just modified the code a little (see below)
import UIKit
import RealityKit
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
override func viewDidLoad() {
super.viewDidLoad()
setupArView()
// Load the "Box" scene from the "Experience" Reality File
let boxAnchor = try! Experience.loadBox()
// Add the box anchor to the scene
arView.scene.anchors.append(boxAnchor)
}
func setupArView() {
let frameRect = CGRect(x: 0, y: 0, width: 100, height: 100)
let cameraMode = ARView.CameraMode.nonAR
arView = ARView(frameRect: frameRect, cameraMode: cameraMode, automaticallyConfigureSession: false)
}
}
When I look at the error of XCode editor:
I have:
On line 22
Type 'ARView' has no member 'CameraMode' ... that is a very bad news
Any clue / or sample code ?
Regards
As mentioned, if your target is simulator or not iOS you can not specify the cameraMode, it will go straight to nonAR. The only initialiser will just take the frame I believe.
Only if you are building for an iOS device (not simulator) can you use the initialiser with cameraMode.
#if os(iOS) && !targetEnvironment(simulator)
arView.cameraMode = .nonAR
#endif
No need to recreate the ARView, just changing the camera mode should be fine.
If you are still stuck it'd be useful to know what your build target is.