开发者

How to allow only iPhone 4 to use app since it uses front camera

开发者 https://www.devze.com 2023-01-11 01:33 出处:网络
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)

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消