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
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
}