rightBarButtonItem 上的访问错误 & “macosx_kill_inferior_safe
按右栏按钮,显示 NCFSString 无法识别的选择器。重新启动时,我没有得到任何有用的堆栈跟踪。
-(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;
,将其切换到 leftBarButtonitem 并得到“NSURL nextIntroStage”..但我没有在应用程序中的任何地方使用 NSURL。当然是某种内存问题,但是什么?
我能想到的唯一相关的事情是在我正在做的应用程序委托中
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:viewController];
[window addSubview:nc.view];
[window makeKeyAndVisible];
[nc release];
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addSubview:
方法仅保留您添加的视图,而不保留导航控制器。通过使用[nc release]
释放该导航控制器,您实际上是在销毁该视图的navigationController。将
nc
的声明移至您的 .h,在didFinishLaunchingWithOptions
中照常初始化它,并在dealloc
中释放它。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
nc
to your .h, initialise it as usual in yourdidFinishLaunchingWithOptions
and release it in yourdealloc
.