Reputation: 79776
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.
Upvotes: 2
Views: 3457
Reputation: 1142
You need to also initialize a SCNScene and add it to the ARSCNView.
let scene = SCNScene()
sceneView.scene = scene
I usually do this before I set up the session too.
Upvotes: 0
Reputation: 59
There is another problem due to iOS11 beta1 bug, iOS 11 Beta 1 Release Notes And Known Issues According To Apple
This means you need an iPhone 6S or better to use ARKit(ARSessionConfiguration) at the current time. Until the iOS11 beta2 release...
2017.07.13 update
My iphone6 had update to iOS11 beta3, and it can run ARWorldTrackingSessionConfiguration, amazing!
2017.09.07 update
iphone6 can not run ARWorldTrackingConfiguration in recently iOS11 beta...... :(
Upvotes: 0
Reputation: 6067
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.
Upvotes: 2
Reputation: 1709
ARWorldTrackingSessionConfiguration supports only iOS devices with an A9 processor or later.
As per Apple doc:
On iOS devices with an A9 processor or later, the ARWorldTrackingSessionConfiguration subclass provides high-precision motion tracking and enables features to help you place virtual content in relation to real-world surfaces.
On other devices supported by ARKit, the ARSessionConfiguration base class provides basic motion tracking that permits slightly less immersive AR experiences.
iPhone and Processors:
iPhone 6 and iPhone 6 plus has A8 processor.
iPhone SE, iPhone 6s, iPhone 6s plus has A9 processor.
iPhone 7, iPhone 7plus has A10 processor
Upvotes: 0