I was wondering how to only let iPhone 4 use my app which uses the front camera.
Can I do a + (BOOL)isCameraDeviceAvai开发者_开发百科lable:(UIImagePickerControllerCameraDevice)
and how do I implement it so that it gives some sort of error if it returns no
or do I have to a NSString *DeviceType etc..
if iPhone 4 ... do nothing
if else ... Display alert?
How do I implement that in my app?
TIA!
You could add front-facing-camera
to UIRequiredDeviceCapabilities
in your Info.plist
. That way the app won't run without front camera and your users won't be able to download it from the App Store without an iPhone 4.
Put this in your app delegate's applicationDidFinishLaunching
method:
if (![UIImagePickerController isCameraDeviceAvailable: UIImagePickerControllerCameraDeviceFront])
{
[[[[UIAlertView alloc] initWithTitle: @"No Front Camera"
message: @"This app requires a front camera."
delegate: self
cancelButtonTitle: @"Ok"
otherButtonTitles: nil] autorelease] show];
}
精彩评论