8

I have created an ARKit project using a beta version of Xcode 9, which I was able to run on my real device without issues.
Yesterday, I upgraded to Xcode 9 GM, and without touching anything, Xcode shows multiple errors, saying it does not know ARSessionConfiguration i.e.:

Use of undeclared type 'ARSessionConfiguration'

and:

Use of undeclared type 'ARWorldTrackingSessionConfiguration'

...for this code:

let session = ARSession()
var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()

I have imported ARKit and am using the ARSCNViewDelegate in my ViewController.
When opening the project from the beta version of Xcode, it does not show the errors and I can again run the app on my phone.

Any idea how I can fix this?

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174

2 Answers2

22

ARWorldTrackingSessionConfiguration has been deprecated and renamed to ARWorldTrackingConfiguration: See here

Also, ARSessionConfiguration has been deprecated and renamed to ARConfiguration, which is now an abstract base class.

Use AROrientationTrackingConfiguration when you don't want world tracking, instead of using a generic ARConfiguration. Thus:

let configuration = AROrientationTrackingConfiguration()

You can also check if world tracking is supported on a device:

if ARWorldTrackingConfiguration.isSupported {
   configuration = ARWorldTrackingConfiguration()
}
else  {
   configuration = AROrientationTrackingConfiguration()
} 
Nana Ghartey
  • 7,901
  • 1
  • 24
  • 26
6

In Xcode 9 GM, looks like ARWorldTrackingSessionConfiguration has been renamed to ARWorldTrackingConfiguration:

https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration

Reference to this change:

https://github.com/markdaws/arkit-by-example/issues/7

ARSessionConfiguration has been renamed to ARConfiguration:

https://developer.apple.com/documentation/arkit/arconfiguration

atomarch
  • 276
  • 1
  • 7
  • 1
    Close, but not quite — `ARConfiguration` is now an abstract base class. If you were using `ARSessionConfiguration` directly (for 3DOF-only tracking) in betas, [`AROrientationTrackingConfiguration`](https://developer.apple.com/documentation/arkit/arorientationtrackingconfiguration) is what you need now. – rickster Sep 20 '17 at 22:18