Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
Basically, in my FirstViewController, I have an IBAction to push a ViewController using the navigationController.
Code:
- (IBAction)openInbox:(UIButton*)sender {  
    NSLog(@"Trying to launch displayInboxTable");
    UIViewController *inboxVC=[[XLappMgr get ]getInboxViewController];
    [self.navigationController pushViewController:inboxVC animated:YES];
}
I also have a NSObject file for several of my methods, and want to perform the same action when one of those methods is called. Since an NSObject doesn't have a navigation controller, I set up the code like this:
Code:
NSLog(@"CodeCalled");
UIViewController *inboxVC=[[XLappMgr get ]getInboxViewController];
                    FirstViewController *appDelegate = (FirstViewController *)[[UIApplication sharedApplication] delegate];

                    [appDelegate.navigationController pushViewController:inboxVC animated:YES];
I try to run the code, and the NSLog gets called, but the app crashes with this in console for reason:
Code:
2012-03-10 22:06:47.450 Bell Avenue[341:707] CodeCalled
2012-03-10 22:06:47.451 Bell Avenue[341:707] -[BellAvenueAppDelegate navigationController]: unrecognized selector sent to instance 0x2e6ba0
2012-03-10 22:06:47.453 Bell Avenue[341:707] *** Terminating app due to uncaught exception
Why is it trying to pull a navigation controller from the AppDelegate for my code, instead of from FirstViewController?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.