UIPopoverController, good example to create and manage it


I’ve searched this tutorial because i had the following error:

*** Terminating app due to uncaught exception ‘NSGenericException’, reason: ‘-[UIPopoverController dealloc] reached while popover is still visible.’

Note, that it’s really important to create the IBOutlet instance of the popover controller in your calling class header!

@interface MapViewController : UIViewController {

    UIPopoverController *popoverController;


 – (IBAction)ShowDevices:(id)sender;

@property (weak, nonatomic) IBOutlet UIBarButtonItem *btnShowDevices;

@property (nonatomic, retain) UIPopoverController *popoverController;