ARSessionConfiguration is not allowed in Xcode 9 GM

I created an ARKit project using the beta version of Xcode 9, which I was able to run on my real device without any problems.
Yesterday I upgraded to Xcode 9 GM and, without touching anything, Xcode shows several errors saying that it does not know ARSessionConfiguration ie:

Using the undeclared type "ARSessionConfiguration"

and

Using the undeclared type "ARWorldTrackingSessionConfiguration"

... for this code:

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

I have imported ARKit and am using ARSCNViewDelegate in my ViewController.
When I open a project from the beta version of Xcode, it shows no errors, and I can run the application on my phone again.

Any idea how I can fix this?

+5
source share
2 answers

ARWorldTrackingSessionConfiguration deprecated and renamed to ARWorldTrackingConfiguration : See here

In addition, ARSessionConfiguration deprecated and renamed to ARConfiguration , which is now an abstract base class.

Use AROrientationTrackingConfiguration when you do not want to track the world, instead of using the general ARConfiguration. In this way:

 let configuration = AROrientationTrackingConfiguration() 

You can also check if tracking is supported worldwide on the device:

 if ARWorldTrackingConfiguration.isSupported { configuration = ARWorldTrackingConfiguration() } else { configuration = AROrientationTrackingConfiguration() } 
+13
source

In Xcode 9 GM, it looks like ARWorldTrackingSessionConfiguration is renamed to ARWorldTrackingConfiguration:

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

Link to this change:

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

ARSessionConfiguration renamed to ARConfiguration:

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

+6
source

Source: https://habr.com/ru/post/1271973/


All Articles