ARSession 在 Testflight 中崩溃,而不是在 Xcode 中

ARSession crashes with Testflight, not with Xcode

我制作了一个使用后置摄像头跟踪 2D body 运动数据的应用程序。我按照 Apple's example 从故事板创建了一个 ARView,并在我的 viewDidAppear 中添加了这段代码:

arView.session.delegate = self

// If the iOS device doesn't support body tracking, raise a developer error for
// this unhandled case.
guard ARBodyTrackingConfiguration.isSupported else {
    fatalError("This feature is only supported on devices with an A12 chip")
}

// Run a body tracking configration.
let configuration = ARBodyTrackingConfiguration()
arView.session.run(configuration)

当我打开应用程序时,从 Xcode 安装时一切正常,但从 TestFligth 安装时应用程序崩溃。崩溃日志显示了 arView.session.delegate = self

的最后一个回溯日志

我找到了解决方法,以防有人遇到同样的问题。根据 Apple,这是 XCode 11 中的一个已知问题。要解决它,您需要手动将 RealityKit 添加到目标的 Link 带有库构建阶段的二进制文件中。希望这有帮助