IOS判断手机设备是否支持照相功能

判断iphone手机是否包含照相功能和闪光灯功能:
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        NSLog(@"设备具备相机");
    }
    if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]) {
        NSLog(@"设备有前置摄像头");
    }
    if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) {
        NSLog(@"设备有后置摄像头");
    }
    if ([UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceFront]) {
        NSLog(@"具备前置闪光灯");
    }
    if ([UIImagePickerController isFlashAvailableForCameraDevice:UIImagePickerControllerCameraDeviceRear]) {
        NSLog(@"具备后置闪光灯");
    }

你可能感兴趣的:(IOS判断手机设备是否支持照相功能)