Search code examples
iphoneobjective-cipaduitableviewuipopovercontroller

UIPopover Not Showing, Causing Crash


I'm using this code to show a popover from the toolbar of the detail view of a split view controller.

- (IBAction)showBookmarksMenu:(id)sender
{
    BookmarksViewController* content = [[BookmarksViewController alloc] init];//UITableViewController
    UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:content];
    aPopover.delegate = self;
    [content release];

    // Store the popover in a custom property for later use.
    self.popoverController = aPopover;
    [aPopover release];

    [self.popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

Getting this crash:

2011-08-16 23:59:55.730 Codes[3646:707] -[DetailViewControlleriPad showBookmarksMenu]: unrecognized selector sent to instance 0x191220
2011-08-16 23:59:55.757 Codes[3646:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewControlleriPad showBookmarksMenu]: unrecognized selector sent to instance 0x191220'

Solution

  • The showBookmarksMenu: method is being called on DetailViewControlleriPad, whereas it should be called on the class which implements it.

    Ensure that the method is properly hooked in IB.