views:

329

answers:

2

I'm creating an iPad app, and I have two classes: NWRootViewController : UITableViewController and UINewFeedViewController : UIViewController. In NWRootViewController I have an UIBarButtonItem, which, when tapped, pops up a modal view controller called NWNewFeedViewController:

// THIS CODE IS IN NWROOTVIEWCONTROLLER.M
// New Feed
-(IBAction)showNewFeedViewAction:(id)sender {
    [newFeedViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [self presentModalViewController:newFeedViewController animated:YES];
}

This works fine. However, in the NWNewFeedViewController's view, I have another UIBarButtonItem which does this when tapped:

// THIS CODE IS IN NWNEWFEEDCONTROLLER.M
// Buttons
-(IBAction)cancelAction:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

When I tap this button, the app crashes with:

2010-04-10 12:39:46.703 News[580:207] *** -[NWDetailViewController cancelAction:]: unrecognized selector sent to instance 0x4741110
2010-04-10 12:39:46.705 News[580:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NWDetailViewController cancelAction:]: unrecognized selector sent to instance 0x4741110'
2010-04-10 12:39:46.705 News[580:207] Stack: (
    40878667,
    2458187017,
    41150267,
    40613142,
    40609810,
    2776006,
    4876265,
    2776006,
    3246293,
    3255055,
    3250242,
    2899304,
    2793965,
    2825287,
    49238396,
    40419388,
    40415304,
    49232029,
    49232226,
    2817505
)

Can anyone help me? Thanks

+2  A: 

Your cancel button has a target of your detail controller; you meant to target your new feed controller. So check how you configured the cancel button.

Paul Lynch
Actually, you are totally right! This is because of my stupidity that I `always` connect everything to the wrong outlets in IB -_-. Thanks ^^
Time Machine
A: 

Your app is trying to call an object that has already been released. Enable zombie objects as explained here to find out what object is trying to be accessed.

rein
Mmm... doesn't seem to work. Also overriding `-(void)release` and use `NSLog` doesn't log anything, and Insruments also doesn't seem to tell anything about `NWNewFeedViewController`.
Time Machine
YEs, that's not what the error message you got was saying. Totally different. Although that's a useful debugging tip.
Paul Lynch