0

I have an app where I'm trying to recursively load views. So I have one view (theViewController) that is able to drill down into another view of the same type (theViewController). I have the recursion working fine and the back buttons work just fine. But I'm trying to implement a function that does some work and then unloads the current view.

In another spot in my code I have the following:

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

It is also at the end of a function that does some work for that view (theSecondViewController), but it loads a different view (theViewController).

My problem is when I use this SAME code in my theViewController it breaks down. Well, kind of. I think it goes through and does pop the controller off, but when it tries to reload the view (theViewController) to the left of it (above it, however you want to think about it) it dies. Once in a blue moon it will spit out:

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

But usually it just dies without errors (at least I think thats what this stuff is):

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.

Any help in understanding why it might die on reloading a page would be very helpful.

Update: If there was an error with the nib wouldn't an issue come up earlier? I believe that it is correct. I'm just not sure where the code is going after [navigationController popViewControllerAnimated:YES]; I thought it would go to the next view's viewDidLoad. But I have a NSLog message there and its not showing up.

The navigation I can do thus far is this:

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

If its straight in and straight out it works fine. The code above works in theSecondViewController but not theViewController

4

2 回答 2

0

您确定笔尖配置正确吗? 我遇到过这种情况,结果是笔尖。可能是,我不记得笔尖到底出了什么问题。有一阵子了。

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

于 2009-06-29T17:59:27.940 回答
0

我遇到的问题是我在不应该发布的时候发布了 NSManagedObjects。

于 2009-06-29T19:31:42.127 回答