UIPopoverController: dealloc reached while popover is still visible

此生再无相见时 提交于 2019-12-12 03:34:40

问题


I am working on an app that lets the user select images from his own photo album. It works on iPhone, but not on iPad.

I made a UIPopoverController, and it all works fine, the user can pick a photo, but when the user pushes "USE" button. the app cashes a says

UIPopoverController dealloc] reached while popover is still visible

here is the code:

- (void)choosePhotoFromLibraryipad:(id)sender{


    if(![popoverController isPopoverVisible]){


    imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = YES;

    self.popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];

    [self.popoverController presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0)
    inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES ];

    }
}

回答1:


Check your .h file. Make sure that your @property for your popoverController is strong instead of weak. Many an hour of time has been wasted over simple things like this.



来源:https://stackoverflow.com/questions/15373312/uipopovercontroller-dealloc-reached-while-popover-is-still-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!