ARSessionConfiguration在Xcode 9 GM中未解决
我已经使用Xcode 9的testing版创build了一个ARKit
项目,我可以在真正的设备上运行,而且没有问题。
昨天,我升级到了Xcode 9 GM,并且没有碰到任何东西,Xcode显示了多个错误,说它不知道ARSessionConfiguration
即:
使用未声明的types“ARSessionConfiguration”
和:
使用未声明的types“ARWorldTrackingSessionConfiguration”
…这个代码:
let session = ARSession() var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()
我已经导入ARKit
并在我的ViewController中使用ARSCNViewDelegate
。
当从Xcode的testing版本打开项目时,它不显示错误,我可以再次运行我的手机上的应用程序。
任何想法如何我可以解决这个问题?
ARWorldTrackingSessionConfiguration
已被弃用, ARWorldTrackingConfiguration
命名为ARWorldTrackingConfiguration
: 请参阅此处
此外, ARSessionConfiguration
已被弃用, ARSessionConfiguration
命名为ARConfiguration
,它现在是一个抽象的基类。
如果您不想要世界追踪,请使用AROrientationTrackingConfiguration ,而不要使用通用ARconfiguration。 从而:
let configuration = AROrientationTrackingConfiguration()
您还可以检查设备是否支持世界追踪:
if ARWorldTrackingConfiguration.isSupported { configuration = ARWorldTrackingConfiguration() } else { configuration = AROrientationTrackingConfiguration() }
在Xcode 9 GM中,看起来像ARWorldTrackingSessionConfiguration已经改名为ARWorldTrackingConfiguration:
https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration
参考这个变化:
https://github.com/markdaws/arkit-by-example/issues/7
ARSessionConfiguration已被重命名为ARConfiguration:
https://developer.apple.com/documentation/arkit/arconfiguration