Show the Pop Over while previous Pop Over still visible cause apps crash?

Discussion in 'iOS Programming' started by cthesky, Feb 5, 2012.

  1. macrumors member

    Aug 21, 2011
    Hi all,

    In my project, when I clicked a Bar Button, a pop over will be displayed, but when I clicked the Bar Button again while the previous pop over still visible, it cause the application crash. Below is my code that show the pop over when click on Bar Button:

    -(IBAction) showPopOver:(id) sender
            PopOverViewController *popOver = [[PopOverViewController alloc]     
            initWithNibName:@"PopOverViewController" bundle:[NSBundle 
            UIPopoverController * myPopOver = [[UIPopoverController alloc]   
            myPopOver.delegate = self;
            [popOver release];
            self.popOverController = myPopOver;
            [myPopOver release];
            [self.popOverController presentPopoverFromBarButtonItem:sender 
    After I do some survey, I found that may be I need do some checking using isPopoverVisible property when need display pop over. But I hope I can find out why my application will crash? Anyone know why the above case will occur?

    Any comments and ideas are welcome and appreciated. Thanks a lot. :)

Share This Page