I'm trying to create ARSession
, using ARKit with Xcode 9 beta (for iOS 11). But it seems not working properly.
Code I've tried is:
override func viewDidLoad() {
super.viewDidLoad()
// configure session
let configuration = ARWorldTrackingSessionConfiguration()
configuration.planeDetection = .horizontal
// run session
sceneView.session.run(configuration)
}
Can anyone help? Code is almost correct according to Apple Documentation.
You have problem with View controller's life cycle. According to apple guideline for ARSession, it Session can after you view is loaded completely. I mean, user view will appear to run your session.
Here is apple document for the same: Building a Basic AR Experience
Also, look at following sample.