Alex Rivera | Logout

Detect existence of camera in iPhone app?

Asked 2010-09-04T20:46:13.710
72

I'm writing an iOS app, and I need to be able to detect if the device has a camera. Previously, I would check if the device is an iPhone or not, since only the iPhone has a camera - but with the launch of the iPod Touch 4 this is no longer a viable option. The app functions without a camera, but the presence of a camera adds functionality.

So, can anyone provide me with code that returns whether there is a camera or not?

Edit
Report

1 Answer

20

Yes, there is an API provided to do just that:

BOOL isCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
answered 2010-09-04T21:09:20.263

Your Answer