iPhone/iPod 功能检测?
有谁知道检查设备是否支持特定功能(例如相机)的推荐方法。 我知道我可以使用 UIDevice 检测应用程序所在的设备,但我想知道是否有办法枚举设备的功能?
Does anyone know the recommended way to check whether the device supports specific capabilities, for example the camera. I know I can detect the device the app is on with UIDevice but I was wondering if there is a way to enumerate the device's capabilities?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定是否有办法枚举设备的所有功能。 通常,此检查是根据功能进行的。
因此,以您的示例为例,如果您想知道正在运行的设备是否具有拍照功能,您可以:
对于任何 iPhone,这都会返回 true (YES),对于任何 iPod,都会返回 false (NO)触摸(至少在撰写本文时)。
I'm not sure if there is a way to enumerate all of the device's capabilities. Usually, this check is done on a capability by capability basis.
So, to use your example, if you would like to know if the device you are running on has the capability to take a picture, you would:
This would return true (YES) for any iPhone, and false (NO) for any iPod Touch (at least at the time of this writing).