解决方案 »

  1.   

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
            UIImagePickerController *controller = [[UIImagePickerController alloc] init];
            controller.sourceType = UIImagePickerControllerSourceTypeCamera;
            __weak id imagePickerDelegate = self;
            controller.delegate = imagePickerDelegate;
            controller.allowsEditing = YES;
            [self presentViewController:controller animated:NO completion:nil];
        }
        else
        {
            UIAlertView *alter = [[UIAlertView alloc]initWithTitle:nil message:@"Camera not available" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alter show];
        }