1. 程式人生 > >iOS8的iPad環境下打不開相簿或者拍照

iOS8的iPad環境下打不開相簿或者拍照

但是在iOS8的iPad環境下,卻打不開相簿或者拍照,提示如下:

Warning: Attempt to present <UIImagePickerController: 0x7fb3d1167a00>  on <CubeWebViewController: 0x7fb3d324ad20> which is already presenting (null)

解決方法如下:

[[NSOperationQueue mainQueue] addOperationWithBlock:^{
                UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
                self.popoverController = popover;
                [self.popoverController presentPopoverFromRect:CGRectMake(0, 0, 600, 800) inView:self.viewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
            }];
在pop的地方加上 

 [[NSOperationQueuemainQueue] addOperationWithBlock:^{

 //code...

}];