UIImagePickerController not presenting in iOS 8

后端 未结 12 1560
借酒劲吻你
借酒劲吻你 2020-12-12 16:39

Is anyone else having an issue with UIImagePickerController in iOS 8? The method below works perfectly well in iOS 7 on an iPad, but I get the following error

12条回答
  •  遥遥无期
    2020-12-12 17:02

    Here is a solution that worked for me

    if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
    {
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
    
            [self presentViewController:cameraUI animated:NO completion:nil];
        }];
    
    }
    else{
    
        [controller presentViewController:cameraUI animated:NO completion:nil];
    }
    

    Remember to alloc cameraUI

    UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
    cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
    

    Build and Go!

提交回复
热议问题