2009-06-29 69 views
0

我有一个应用程序,我试图递归加载视图。所以我有一个视图(theViewController)能够深入到相同类型的另一个视图(theViewController)。我有递归工作正常,后面的按钮工作得很好。但是我试图实现一个可以完成一些工作然后卸载当前视图的函数。UINavigationController - 相同的viewController

在我的代码中的另一个点,我有以下:

MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; 
UINavigationController *navigationController = [delegate navigationController]; 
[navigationController popViewControllerAnimated:YES]; 

也正是在那做了一些工作,该视图(theSecondViewController)函数的结束,但它加载不同的看法(theViewController )。

我的问题是当我在我的theViewController中使用这个SAME代码时,它打破了。好吧,那种。我认为它通过并且确实弹出控制器,但是当它试图重新加载视图(theViewController)到它的左边(在它上面,但是你想要考虑它)时,它会死掉。一旦在一个蓝色的月亮就会吐出:

malloc: *** error for object 0xfb9640: double free 
*** set a breakpoint in malloc_error_break to debug 

但通常它只是死了,没有错误(至少我认为是这样的东西是什么):

GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all 
Attaching to process 15739. 

任何帮助理解为什么它可能在重新加载页面时死亡将非常有帮助。

更新: 如果在笔尖出现错误,问题不会提前出现吗?我相信这是正确的。我只是不确定代码在[navigationController popViewControllerAnimated:YES]之后的位置;我认为它会去下一个视图的viewDidLoad。但我有一个NSLog消息,并没有显示。

我可以做迄今为止,导航是这样的:

userViewController -> theViewController -> ... -> theViewController -> theSecondViewController 

如果它笔直挺拔了,它工作正常。上面的代码在SecondViewController中运行,但不在控制器中运行

回答

0

我遇到的问题是,当我不应该发布NSManagedObjects时。

0

您确定nibs配置正确吗?我曾经遇到过这种情况,事实证明这是笔尖。可能是,我不记得那个笔尖到底出了什么问题。有一阵子了。

但这是要检查的东西。此外,您是否尝试了解代码并确定其停止工作的位置?我不确定它将有可能根据上面提供的内容给出直接的答案...

相关问题