从 UINavigationController 弹出时崩溃
我有几个由导航控制器控制的视图控制器。
例如,viewController A 和 viewController B 都可以将 viewController C 压入导航堆栈并要求 C 进行一些保存(实际上对 C 的意思是一样的)。
在C的保存方法中,最后一行代码是
[self.navigationController popViewControllerAnimated:YES];
但是问题是,
如果我从A推送到C,在我保存一些内容并弹回A之后,一切都会顺利。
但是如果我从B推送C,在我做同样的事情并弹回到B之后,应用程序崩溃了,
通过我的调试,我发现应用程序崩溃不是在C的代码中,
而是在B的viewWillAppear方法之后,这里我的意思是之后,B正确运行 viewWillAppear 中的所有代码,
但随后在我不知道如何跟踪的地方崩溃。
这个错误对我来说很奇怪:
2012-02-13 00:29:30.975 EasyWallet[43116:707] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
*** First throw call stack:
(0x344268bf 0x346761e5 0x344267b9 0x344267db 0x35d72121 0x2ce7b 0x2ba75 0x3782f9cb 0x3782eaa9
0x3782e233 0x377d2d4b 0x3438522b 0x34f16381 0x34f15f99 0x34f1a11b 0x34f19e57 0x34f11d85
0x343fab4b 0x343f8d87 0x343f90e1 0x3437c4dd 0x3437c3a5 0x30c00fcd 0x377fd743 0x2179 0x2138)
terminate called throwing an exception(gdb)
我只是不知道如何修复它。
I have several viewControllers controlled by a navigation controller.
For example, viewController A and viewController B can both push viewController C into the navigation stack and ask C to do some saving (actually means the same to C).
in the saving method of C, the last line of code is
[self.navigationController popViewControllerAnimated:YES];
But problem is,
If I push to C from A, after I save something and pop back to A, things goes well.
But if I push C to from B, after I do the same thing and pop back to B, app crashes,
with my debugging, I found that app crashed not in C's code,
but after B's viewWillAppear method, here I mean after, B correctly runs all of the codes in viewWillAppear,
but then crashes somewhere I don't know how to trace to.
and the Error is very strange to me:
2012-02-13 00:29:30.975 EasyWallet[43116:707] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
*** First throw call stack:
(0x344268bf 0x346761e5 0x344267b9 0x344267db 0x35d72121 0x2ce7b 0x2ba75 0x3782f9cb 0x3782eaa9
0x3782e233 0x377d2d4b 0x3438522b 0x34f16381 0x34f15f99 0x34f1a11b 0x34f19e57 0x34f11d85
0x343fab4b 0x343f8d87 0x343f90e1 0x3437c4dd 0x3437c3a5 0x30c00fcd 0x377fd743 0x2179 0x2138)
terminate called throwing an exception(gdb)
I just don't know how to fix it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在处理大量视图控制器和视图时,经常会发生崩溃。我在不使用 ARC 时也遇到了同样的问题。当时我发现最好的方法是使用以下链接来进入确切的崩溃状态。唯一的事情是你需要在控制台仔细分析结果,并应该更好地判断它......
http: //www.cocoadev.com/DebuggingAutorelease.html
While dealing with number of viewControllers and views, it happens that frequent crashes occurs. I also had same problem when not using ARC. At that time i found the best way out is using following link to get into exact crash. The only thing is you need to carefully analyzed the result at console and should judge it better way...
http://www.cocoadev.com/DebuggingAutorelease.html