Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有谁知道检查设备是否支持特定功能(例如相机)的推荐方法。我知道我可以使用 UIDevice 检测应用程序所在的设备,但我想知道是否有办法枚举设备的功能?
我不确定是否有办法枚举设备的所有功能。通常,此检查是在逐个能力的基础上进行的。
因此,以您的示例为例,如果您想知道正在运行的设备是否具有拍照功能,您可以:
[UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera];
对于任何 iPhone,这将返回 true (YES),对于任何 iPod Touch 将返回 false (NO)(至少在撰写本文时)。