Ios iPad有时不使用前摄像头

Ios iPad有时不使用前摄像头,ios,ipad,camera,uiimagepickercontroller,Ios,Ipad,Camera,Uiimagepickercontroller,在我的应用程序中,我必须使用ipad的前摄像头,并且必须使用前摄像头拍照。我正在使用方法[self.imagePickerController takePicture]自动拍照 有一个倒计时,倒计时后,应用程序会自动拍照。用户可以拍摄多张照片。当用户拍摄第一张照片时,应用程序使用前摄像头,但当用户拍摄第二张照片时,应用程序使用后摄像头,我只想使用前摄像头。请帮忙。 我的代码如下: - (IBAction)btnTakePic:(id)sender; { if ([UIImagePicke

在我的应用程序中,我必须使用ipad的前摄像头,并且必须使用前摄像头拍照。我正在使用方法
[self.imagePickerController takePicture]自动拍照
有一个倒计时,倒计时后,应用程序会自动拍照。用户可以拍摄多张照片。当用户拍摄第一张照片时,应用程序使用前摄像头,但当用户拍摄第二张照片时,应用程序使用后摄像头,我只想使用前摄像头。请帮忙。
我的代码如下:

- (IBAction)btnTakePic:(id)sender;
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

        //[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

        //Set Notifications so that when user rotates phone, the orientation is reset to landscape.
        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

        imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;


        imagePickerController.delegate = self;
        imagePickerController.showsCameraControls = NO;

        imagePickerController.cameraDevice= UIImagePickerControllerCameraDeviceFront;


        [imagePickerController setWantsFullScreenLayout:YES];

        [self presentModalViewController:imagePickerController animated:YES];
    }

    [NSTimer scheduledTimerWithTimeInterval:3.0
                                     target:self
                                   selector: @selector(targetMethod)
                                   userInfo:nil
                                    repeats:NO];
}
- (void)targetMethod
{
    [self.imagePickerController takePicture];

}

尝试检查iCameradeViceAvailable:UIImagePickerControllerCameraDeviceFront。也许它很忙。我试过了,但它不起作用。这种情况总是会发生,但仍然使用后置凸轮