0

Currently, I am creating an application with Deployment Target 10.2.
I have ViewControllerA and ViewControllerB available.
All users can view ViewControllerA.
I would like to allow iOS 11 users to view ViewController B.
By tapping button AR of ViewController A, processing is divided between iOS 10 and iOS 11.
I am writing the following code.

@IBAction func goARCameraTapped(_ sender: UIButton) {

    if (ProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 11) {
    self.performSegue(withIdentifier: "goAR", sender: self)
        print("iOS11")
    } else if (ProcessInfo.processInfo.operatingSystemVersion.majorVersion <= 10) {
        print("iOS10")
    }
}

With Deplooyment Target 10.2.
When the user of iOS 11 taps the button AR of ViewController A, the user of iOS 11 wants to move it to Viewcontroller B.
Next, after the user of iOS 11 moves to ViewController B, I want to display the ARSCNView.
However, the following error is displayed.
- Error
ARSCNView before iOS 11.0
enter image description here

If I set Depoyment Target to 11.0, the above error will not be displayed.
However, when I set Depoyment Target 11, I think that iOS 10 users can not download my application.

â– Question
Is there a way for iOS 11 users to display ARSCNView with Deployment Target 10.2?

-Additional notes.
xcode9.0.1
swift4
iPhoneSE and iPhone7.

The code of ViewControllerB is as follows.

import UIKit
import ARkit

class ARViewController: UIViewController, ARSCNViewDelegate {

    @IBOutlet weak var sceneView: ARSCNView!
    let configuration = ARWorldTrackingConfiguration()

    override func viewDidLoad() {
        super.viewDidLoad()
        setupSceneView()
    }
    func setupSceneView() {
        self.sceneView.showsStatistics = true
        self.sceneView.session.run(configuration)
        self.sceneView.delegate = self
    }


ginger
  • 69
  • 9

1 Answers1

0

ARSCNView is supported from iOS 11.0 and later.

Add it using code rather than Storyboard

Its availability has not been mentioned for its previous version till now. And its clearly said that its new feature for iOS 11.

Hence the answer for your question is - Its is not a backward capable. However, depending on your requirement, you can use SceneKit as fallback, add ARSCNView to your project using code and iOS version checking.

if #available(iOS 11.0, *) {
    // add ARKit to your view
} else {
    // add SceneKit to your view
}