iPhone etc: how to tell if the device has a camera?
Version 3.1.3 if its relevant.
开发者_开发知识库There is this suggestion which may work now, but in the future?
NSString *device = [UIDevice currentDevice].model;
if([device isEqualToString:@"iPhone"])
#define SOURCETYPE UIImagePickerControllerSourceTypeCamera
// does the device have a camera?
if ([UIImagePickerController isSourceTypeAvailable:SOURCETYPE]) {
// if so, does that camera support video?
NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:SOURCETYPE];
bool isA3GS = [mediaTypes containsObject:(NSString*)kUTTypeMovie];
}
精彩评论