我遵循了本教程: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")
}
可能是什么问题?
答案 0 :(得分:0)
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应用程序,则必须在真实设备上运行应用程序。