Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I have to check LSRequiresIPhoneOS in order to find out if camera is available?

In my Xcode project there is Info.plist file in resources. It has an attribute like this:

LSRequiresIPhoneOS

So my question is: do I have to check that? What I want is that my app finds out itself weather there is a camera or not. If not, the feature is disabled, and if yes: Cool! It must work on both iPhone and iPod Touch!

I guess that if I disable this in Info.plist, I can still use iPhone features, and Apple will not refuse my code because of that, right?

like image 384
Thanks Avatar asked Apr 01 '09 15:04

Thanks


1 Answers

You should leave LSRequiresIPhoneOS checked (which is the default value). This does not prevent the app from running on the iPod Touch. It may seem confusing, but in this case "IPhoneOS" is referring to the OS that runs on both the iPhone and the iPod Touch (assuming the user has installed iPhone OS on the Touch so that it can run 3rd-party apps).

Regarding camera usage, you can use something like the following to specifically see if the camera is available:

BOOL isCameraAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];

This kind of approach--checking for specific functionality--is usually better than using the iPhone OS version or hardware model.

like image 87
Clint Harris Avatar answered Nov 06 '22 07:11

Clint Harris