开发者

dismissModalViewControllerAnimated makes my app crash :(

开发者 https://www.devze.com 2022-12-26 14:52 出处:网络
I\'m creating an iPad app, and I have two classes: NWRootViewController : UITableViewController and UINewFeedViewController : UIViewController. In NWRootViewController I have an UIBarButtonItem, which

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,
    2776开发者_如何学C006,
    3246293,
    3255055,
    3250242,
    2899304,
    2793965,
    2825287,
    49238396,
    40419388,
    40415304,
    49232029,
    49232226,
    2817505
)

Can anyone help me? Thanks


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号