ARKit 场景视图在从 MFMailComposeViewController 返回时被阻止



当我从MFMailComposeViewController回来ARSCNView场景被阻止时,我遇到了一个问题,我仍然可以在被阻止的屏幕上与 3D 模型 (hitTesting( 进行交互。

你有什么解决方案吗?

YM

我的错。在我的ARSCNView控制器上,我没有重置功能viewDidAppear上的配置。

要解决它:

override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Prevent the screen from being dimmed to avoid interuppting the AR experience.
UIApplication.shared.isIdleTimerDisabled = true
// Start the `ARSession`.
resetTracking()
}

func resetTracking() {
let configuration = ARWorldTrackingConfiguration()
session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
}

最新更新