title: Popovers cannot be presented from a view which does not have a window-error
body: <p>I have designed a ViewController "CommentsViewController" with xib and i am trying to present it on a popovercontroller over a grid cell when clicked on it...and below is my code</p>
  
  <pre><code>CommentsViewController *popOverVC=[[CommentsViewController alloc]init];
              popOverVC.delegate=self;
              popOverVC.commentBoxTextView.text=currentExternalGridCell.ratingValueLabel.text;
              popOverVC.contentSizeForViewInPopover=popOverVC.view.frame.size;
              UIPopoverController *popover =[[UIPopoverController alloc]initWithContentViewController:popOverVC];
              popover.delegate=(id)self;
              popoverC=popover;
  
  
  
  
              [popover presentPopoverFromRect:currentExternalGridCell.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
  </code></pre>
  
  <p>but same gives an error..</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController _commonPresentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'
  </code></pre>
  
  <p>i have checked the value of self.view and currentexchangegrid cell both are not nil while i call the presentfromRect method...</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So i found a solution and was easy...</p>
  
  <p>just check whether self.view.window!=nil before showing popover
  ie,</p>
  
  <pre><code>if(self.view.window!=nil)
        [popover presentPopoverFromRect:currentExternalGridCell.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
  </code></pre>