Xcode 9 GM 中的 ARSessionConfiguration 未解决 [英] ARSessionConfiguration unresolved in Xcode 9 GM
问题描述
我使用 Xcode 9 的测试版创建了一个 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
.
从 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,而不是使用通用AR配置.因此:
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屋!