【问题标题】:"Session Failed - probably due to lack of camera access" Xcode Error“会话失败 - 可能是由于缺少摄像头访问权限”Xcode 错误
【发布时间】:2019-02-11 16:02:33
【问题描述】:

我按照本教程:https://www.raywenderlich.com/378-augmented-reality-and-arkit-tutorial 了解增强现实。

当我运行项目时出现错误:

 Session did fail with error: Error Domain=com.apple.arkit.error Code=100 "Unsupported configuration." UserInfo={NSLocalizedDescription=Unsupported configuration., NSLocalizedFailureReason=The provided configuration is not supported on this device.} Session Failed - probably due to lack of camera access.   

即使我使用以下代码进行测试以验证模拟器是否支持 ARKit,我也没有找到此错误的原因:

 if (ARConfiguration.isSupported) {
 print("ARKit is supported. You can work with ARKit")
  } else {
    print("ARKit is not supported. You cannot work with ARKit")
  }

可能是什么问题?

【问题讨论】:

  • 可能是因为您在模拟器上运行您的应用程序
  • 不能在模拟器上运行带有增强现实的应用程序吗?
  • 哦,你实际上可以在模拟器上运行你的应用程序,但它不会像你期望的那样工作。 ;)

标签: swift arkit


【解决方案1】:
if ARConfiguration.isSupported {
    print("ARKit is supported. You can work with ARKit")
} else {
    print("ARKit is not supported. You cannot work with ARKit")
}

ARConfiguration.isSupported 实际上并没有表明您运行应用程序的设备(或模拟器)是否能够使用世界追踪或类似的东西(这是许多 AR 功能所必需的)。

您可能想检查是否支持某些ARConfiguration 子类...例如这个ARWorldTrackingConfiguration

if ARWorldTrackingConfiguration.isSupported { ... }

无论如何,这并不能解决出现错误的问题,如果您想测试您的 AR 应用,您必须在真实设备上运行您的应用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-24
    • 1970-01-01
    • 2019-07-26
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    相关资源
    最近更新 更多