在我的 iPad 应用程序中,我试图在 UIPopOverController 中打开前置摄像头。它的行为很奇怪。当我第一次单击按钮打开摄像头时,它打开前置摄像头,第二次打开后置摄像头,同样重复。一次前置摄像头和第二次后置摄像头。虽然我也将前置摄像头设置为摄像头设备。这是我的代码,请帮忙。
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
[imagePickerController setCameraCaptureMode:UIImagePickerControllerCameraCaptureModePhoto];
[imagePickerController setCameraDevice:UIImagePickerControllerCameraDeviceFront];
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];