pion
pion

Reputation: 391

iphone: Adding UIRequiredDeviceCapabilitie

I am reading the "Device Support - Setting Required Hardware Capabilities" on http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedFeatures/AdvancedFeatures.html

I want to add still-camera capability by doing the following:

  1. Open my Info.plist
  2. Click +
  3. Add UIRequiredDeviceCapabilities on the Key column
  4. Add still-camera on the Value column
  5. Save the updated Info.plist

Is this the correct way?

Thanks in advance for your help.

Upvotes: 3

Views: 2961

Answers (3)

Mark Krenek
Mark Krenek

Reputation: 4947

You don't necessarily need to set up UIRequiredDeviceCapabilities as a dictionary. It can also be an array. You use a dictionary if some of your options need to be YES and some need to be NO. If you're just trying to set capabilities you require, using an array can be a little simpler.

See "UIRequiredDeviceCapabilities " at https://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

Upvotes: 1

pion
pion

Reputation: 391

Someone at the Developer Forum answered my question.

At the Raw Values/Keys mode

  • Click + sign to add a row
  • Enter UIRequiredDeviceCapabilities
  • XCode recognizes the key and automatically creates an item 0

At the "friendly" (Uncheck Raw Values/Keys) mode

  • Type "Required device capabilities"
  • XCode recognizes it and will auto-complete it

Upvotes: 1

Brad The App Guy
Brad The App Guy

Reputation: 16275

If you only want to have the capability to utilize the still camera, you don't have to do anything, except check that the camera exists at runtime:

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
  //Something
}

This is the correct approach, if your application has utility, even when run on a device without a camera. If, on the other hand, your App needs the camera in order to function, then changing the plist is the correct approach, as this is a signal to Apple that your App can not be used on a device without a camera. In that case the procedure you outlined is correct.

Upvotes: 3

Related Questions