Pressinsg the right bar button, Showed NCFSString unrecognized selector.. on restarting, I get no helpful stack trace.
-(void)nextIntroStage{
_introStage++;
if (_introStage < _maxIntro) {
[self showIntroPicture];
} else {
[self finishedIntro];
}
}
-(void)viewDidLoad {
[super viewDidLoad];
_introStage = 0;
_maxIntro = 3;
UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] initWithTitle:@"Next"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(nextIntroStage)];
self.navigationItem.rightBarButtonItem = nextButton;
Strange, switched it to leftBarButtonitem and am getting “NSURL nextIntroStage”.. but I’m not using an NSURL anywhere in my app. Some kind of memory issue, sure, but what?
Only relevant thing I can think of is in my app delegate I’m doing
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:viewController];
[window addSubview:nc.view];
[window makeKeyAndVisible];
[nc release];
The
addSubview:method only retains the view you have added, not the navigation controller. By releasing that navigation controller with[nc release], you are essentially destroying that view’s navigationController.Move the declaration for
ncto your .h, initialise it as usual in yourdidFinishLaunchingWithOptionsand release it in yourdealloc.