I've added a plugin to scan barcodes in our app and right now I'm checking the device model number (ie iPhone4,1) to see if it is a newer device that has an autofocus camera. This will of course either require us to add new devices everytime they come out or we'll forget to do it and the users won't be able to scan barcodes even though they should be able to.

What I would like to do is check to see if the device has an autofocus camera, and use that to allow or deny the users to try to scan barcodes. Anyone know how?

有帮助吗?

解决方案

You could use isFocusModeSupported from the AVCaptureDevice class in iOS.

Documentation is under 'Focus settings' here:

http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/occ/cl/AVCaptureDevice

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top