首页 > 解决方案 > 在 Swift 中检查 iOS 设备是否有 LiDAR

问题描述

Swift 中有没有办法检查设备是否有 LiDAR 传感器?不幸的是,我在 Apple 官方纪录片和互联网搜索中都没有找到任何内容。

我目前的解决方法是确定设备类型,如本文所述: 如何确定当前的 iPhone/设备型号?

谢谢

标签: iosswiftaugmented-realitylidar

解决方案


使用此代码:-

import ARKit

let supportLiDAR = ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh)
guard supportLiDAR else {
    print("LiDAR isn't supported here")
    return
}

场景重建需要配备激光雷达扫描仪的设备,例如第四代 iPad Pro。

参考:- https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration/3521377-supportsscenereconstruction


推荐阅读