title: Error using UIPopoverController
body: <p>In my current app, I am trying to make a menu screen apear when I click a tool bar button. I found that the best way to do this is to use a  UIPopoverController to show a custom view that I have created. However, something about my current code is flawed. When I run my app and push the button, I get an error that says that it is reaching dealoc while the popover is still visible. Even after looking at several examples of similar problems, I can't for the life of me figure out how to fix this. Here is my code:</p>
  
  <pre><code>-(IBAction)newMenu:(id)sender{
  
  
  newTaskWindow *newTaskWin = [[newTaskWindow alloc]init];
  UIView *test = [[UIView alloc]init];
  test = newTaskWin.view;
  
  UIPopoverController *taskPop = [[UIPopoverController alloc]initWithContentViewController:newTaskWin];
  
  [taskPop setDelegate:self];
  [taskPop presentPopoverFromBarButtonItem:newTaskButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
  [taskPop setPopoverContentSize:CGSizeMake(400, 500)];
  </code></pre>
  
  <p>Any Ideas? Thanks in advance</p>
  
  <p>}</p>
  
  <p>This is the error that it produces:</p>
  
  <pre><code> *** Terminating app due to uncaught exception 'NSGenericException', reason: '-   [UIPopoverController dealloc] reached while popover is still visible.'
  
  *** First throw call stack:
  (0x381fb8bf 0x37d471e5 0x381fb7b9 0x381fb7db 0x32065f71 0x37d430c5 0x37d44db7 0x2ecf       0x38155435 0x31cbe9eb 0x31d843cf 0x38155435 0x31cbe9eb 0x31cbe9a7 0x31cbe985 0x31cbe6f5   0x31cbf02d 0x31cbd50f 0x31cbcf01 0x31ca34ed 0x31ca2d2d 0x37f29df3 0x381cf553 0x381cf4f5   0x381ce343 0x381514dd 0x381513a5 0x37f28fcd 0x31cd1743 0x2bd5 0x2b6c)
  terminate called throwing an exception(gdb)
  </code></pre>