2009-06-29 25 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配置正確嗎?我曾經遇到過這種情況,事實證明這是筆尖。可能是,我不記得那個筆尖到底出了什麼問題。有一陣子了。

但這是要檢查的東西。此外,您是否嘗試瞭解代碼並確定其停止工作的位置?我不確定它將有可能根據上面提供的內容給出直接的答案...

相關問題