Xcode 9 GM中未解决的ARSessionConfiguration [英] ARSessionConfiguration unresolved in Xcode 9 GM
问题描述
我已经使用Xcode 9的beta版创建了ARKit
项目,该项目能够在我的真实设备上运行而没有问题.
昨天,我升级到了Xcode 9 GM,并且在未接触任何东西的情况下,Xcode显示了多个错误,并说它不知道ARSessionConfiguration
即:
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.:
使用未声明的类型'ARSessionConfiguration'
Use of undeclared type 'ARSessionConfiguration'
和:
使用未声明的类型'ARWorldTrackingSessionConfiguration'
Use of undeclared type 'ARWorldTrackingSessionConfiguration'
...对于此代码:
let session = ARSession()
var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()
我已经导入了ARKit
,并且正在我的ViewController中使用ARSCNViewDelegate
.
从Beta版本的Xcode打开项目时,它没有显示错误,我可以在手机上再次运行该应用程序.
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?
推荐答案
ARWorldTrackingSessionConfiguration
已被弃用并重命名为ARWorldTrackingConfiguration
:
ARWorldTrackingSessionConfiguration
has been deprecated and renamed to ARWorldTrackingConfiguration
: See here
此外,不推荐使用ARSessionConfiguration
并将其重命名为ARConfiguration
,现在它是一个抽象基类.
Also, ARSessionConfiguration
has been deprecated and renamed to ARConfiguration
, which is now an abstract base class.
当您不想进行世界跟踪时,请使用 AROrientationTrackingConfiguration ,而不要使用通用的ARConfiguration.因此:
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()
}
这篇关于Xcode 9 GM中未解决的ARSessionConfiguration的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!