How to check the iPhone/iPod is camera supported or not from the application

All iPhone versions up to now are implicitly camera supported. But when we are writing iPhone apps, those can be run in iPhones as well as iPods. iPod don’t have a camera, so we have to check in the application, whether the application is deployed in an iPhone or in an iPod. Rather than doing that, we can check whether the device is camera supported or not by adding the following line of code.

[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]

We can also check whether the device support for a Photo Library or not by following line of code.

[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]

No comments: