Dr_Mom
Dr_Mom

Reputation: 63

Use "SCNView" instead of "ARSCNView" – when it's not supported

I need to show 3D model via ARKit using ARSCNView, however, if user has an unsupported device A8- or iOS version 10-, so the app would use SCNView.

Is it possible to maintain that in one ViewController and Storyboard?

How should I init sceneView in Objective-C?

if (ARConfiguration.isSupported) {
      // use ARSCNView
} else {
      // use SCNView
}

Upvotes: 2

Views: 850

Answers (1)

Ef Dot
Ef Dot

Reputation: 768

In storyboard use ARSCNView and add to your ViewController fallback to SCNView:

override func loadView() {
    if (!ARConfiguration.isSupported) {
        print("ARKit not supported, using SCNView")
        view = SCNView(frame: NSRect(x: 0, y: 0, width: 640, height: 480))
    } else {
        super.loadView() // Use ARSCNView from storyboard
    }
}

Upvotes: 2

Related Questions