2
votes

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.

4
Which device are you trying this on? What does ARSessionConfiguration. isSupported return? - vrwim
@vrwim I tried on my iPad mini 2 (A7 chip) and ARSessionConfiguration is indeed supported. However, ARWorldTrackingSessionConfiguration is not and you cannot freely swap one with another.. it crashes the app - kernelpanic
I tried running in iPad Air with ARSessionConfiguration and it still crashes. - john doe

4 Answers

2
votes

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

0
votes

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
0
votes

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...... :(

0
votes

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.