[UIPopoverController dealloc] reached while popover is still visible.'

        UIImagePickerController *picker =[[UIImagePickerController alloc] init];

        picker.delegate = self;

        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        

        UIPopoverController *popover = [[UIPopoverController alloc]

                                        initWithContentViewController:picker];

        [popover presentPopoverFromRect:CGRectMake(0.0f, 0.0f, 300.0f, 300.0f)

                                 inView:self.view

               permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


iOS6环境,在运行上述代码的时候,跑iPhone的时候没有问题,但是跑iPad的时候就报错:

[UIPopoverController dealloc] reached while popover is still visible.


解决方案:

UIPopoverController *popover = [[UIPopoverController alloc]

                                           initWithContentViewController:picker];

替换成

UIPopoverController *_popover;

_popover = [[UIPopoverController allocinitWithContentViewController:picker];






你可能感兴趣的:([UIPopoverController dealloc] reached while popover is still visible.')