gpt4 book ai didi

ios - 检测 iPhone 应用程序中是否存在摄像头?

转载 作者:IT老高 更新时间:2023-10-28 11:28:25 26 4
gpt4 key购买 nike

我正在编写一个 iOS 应用程序,我需要能够检测设备是否有摄像头。以前,我会检查设备是否是 iPhone,因为只有 iPhone 有摄像头——但随着 iPod Touch 4 的推出,这不再是一个可行的选择。该应用程序在没有相机的情况下运行,但相机的存在增加了功能。

那么,谁能给我提供返回是否有摄像头的代码?

最佳答案

你可以在 UIImagePickerController 中使用 +isSourceTypeAvailable: 方法:

if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
// Has camera

关于ios - 检测 iPhone 应用程序中是否存在摄像头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3643949/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com