dismissModalViewControllerAnimated makes my app crash :(

Posted by Koning Baard XIV on Stack Overflow See other posts from Stack Overflow or by Koning Baard XIV
Published on 2010-04-10T10:42:24Z Indexed on 2010/04/10 11:03 UTC
Read the original article Hit count: 877

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about iphone-sdk