Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - Detecting if the iDevice has a front camera

Tags:

Apple recommends not searching for hardware version, but for the specific feature in which you are interested.

So how may I detect if there is a front camera on the device to be able to disable some features ?

[UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera] only tells that there is a camera somewhere.

like image 626
Oliver Avatar asked Apr 12 '11 00:04

Oliver


People also ask

How do I know if my iPhone front camera is on?

When your iPhone's camera is active a little green dot appears at the top of the screen. This indicator is hardwired to the camera so it cannot be turned off by software.

Does Face ID use front camera?

Replacing the front camera alone does not affect the function of the Face ID, while Face ID will be disabled when replacing the full front camera assembly. Before attempting the actual replacement, a new camera should be plugged in and tested in order to verify that this repair will fix the problem.

What is iPhone camera scene detection?

On iPhone 12 models, the Scene Detection setting can identify what you're taking a photo of and apply a tailored look to bring out the best qualities in the scene. Scene Detection is on by default. To turn off Scene Detection, go to Settings > Camera, then turn off Scene Detection.

Which camera is front camera on iPhone?

The iPhone 14's front camera is also expected to have a larger f/1.9 aperture. For comparison, the iPhone's front camera remains pretty much the same since iPhone 11, when Apple introduced a new 12-megapixel lens with f/2.2 aperture.


1 Answers

Try this method of UIImagePickerController:

+ (BOOL)isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice

This is a class method and UIImagePickerControllerCameraDevice can take two values:

  • UIImagePickerControllerCameraDeviceRear
  • UIImagePickerControllerCameraDeviceFront

Example code:

if( [UIImagePickerController isCameraDeviceAvailable: UIImagePickerControllerCameraDeviceFront ]) {    // do something } 

Note that this is available for iOS 4.0 and later.

like image 190
quaertym Avatar answered Oct 06 '22 06:10

quaertym