如何检查iOS 11安装的设备是否支持ARKit?
问题描述:
我目前正在研究基于ARKit
的应用程序。我需要检查ARKit
支持的设备。如何检查iOS 11安装的设备是否支持ARKit?
我有两个UIViewController
小号
1)ARKit
视图控制器 2)非ARKit
视图控制器。
我必须根据设备支持设置一个视图控制器之一。
目前我在检查下面的代码。但是,这是不工作的一些设备不支持ARKit
但iOS的11
if #available(iOS 11.0, *) {
arProfileClosetController = THARClosetViewController(nibName: THARClosetViewController.className, bundle: nil)
} else {
arProfileClosetController = THNonARClosetViewController(nibName: THNonARClosetViewController.className, bundle: nil)
}
答
您可以在运行时检查此属性:ARConfiguration.isSupported
if (ARConfiguration.isSupported) {
arProfileClosetController = THARClosetViewController(nibName: THARClosetViewController.className, bundle: nil)
} else {
arProfileClosetController = THNonARClosetViewController(nibName: THNonARClosetViewController.className, bundle: nil)
}