I have a button called as Sync. On clicking on it, I need to display a popOverController which displays a few items in UITableView. I have used the following lines of code in .m file to declare the UIButton in ViewWillAppear function :
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Sync"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(syncAction)] ;
The code for syncAction is :
- (void)syncAction:(id)sender{
Sync = [[SyncTableViewController alloc] initWithStyle:UITableViewStylePlain];
Sync.syncDelegate = self;
self.SyncTableViewPopover = [[UIPopoverController alloc]
initWithContentViewController:Sync];
[self.SyncTableViewPopover presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
But, however, on running the application I am getting the following error ::
[splitViewXXXXViewController syncAction]: unrecognized selector sent to instance 0x6b70660
2012-07-02 15:35:59.549 splitView[895:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[splitViewXXXXViewController syncAction]: unrecognized selector sent to instance 0x6b70660'
I am unable to sort it out. Can someone help me to sort it out ?? Thanks and Regards.
You have to use the @selector(syncAction:)
This will resolve you issue