Krunal
Krunal

Reputation: 79776

ARKit - Issue with ARSession

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

Answers (4)

Alan
Alan

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

T.c. Hung
T.c. Hung

Reputation: 59

There is another problem due to iOS11 beta1 bug, iOS 11 Beta 1 Release Notes And Known Issues According To Apple

snapsot image

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

Wasim K. Memon
Wasim K. Memon

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.

enter image description here

Upvotes: 2

KSR
KSR

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

Related Questions