首页 > 解决方案 > 使用 UIImagePickerController 在 iOS 13 上使我的应用程序崩溃

问题描述

当相机打开时,无论我是否点击照片,我的应用程序都会崩溃。

下面给出了使应用程序崩溃的线程:

Error : Thread 6 Queue : com.apple.camera.capture-engine.session-queue (serial). 

我的代码片段:

-(void)TakePhoto :(id)sender
{
    self.appDelegate.PictureTouchIDByPass = true;

    self.BSomethingChanged = true;

    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController* IPC = [[UIImagePickerController alloc] init];

        IPC.sourceType = UIImagePickerControllerSourceTypeCamera;
        IPC.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
        IPC.cameraDevice= UIImagePickerControllerCameraDeviceRear;
        IPC.showsCameraControls = YES;
        IPC.navigationBarHidden = NO;
        IPC.delegate = self;
        [IPC didReceiveMemoryWarning];
        [IPC setVideoQuality:UIImagePickerControllerQualityTypeIFrame1280x720];

        UIDevice* CurrentDevice = [UIDevice currentDevice];

        while ([CurrentDevice isGeneratingDeviceOrientationNotifications])
        {
            [CurrentDevice endGeneratingDeviceOrientationNotifications];
        }

        dispatch_async(dispatch_get_main_queue(), ^
        {
            [self presentViewController:IPC animated:YES completion:nil];
        });
    }
    else
    {
        [self.appDelegate ShowSingleButtonAlertFromDelegate:NSLocalizedString(@"msg_camera_error", nil) DebugModeError:@""];
    }
}

任何帮助,请!

标签: objective-cxcodeios13

解决方案


推荐阅读