ビューを再帰的にロードしようとしているアプリがあります。したがって、同じタイプの別のビュー(theViewController)にドリルダウンできる1つのビュー(theViewController)があります。再帰は正常に機能し、戻るボタンは正常に機能します。しかし、私はいくつかの作業を行ってから現在のビューをアンロードする関数を実装しようとしています。
私のコードの別の場所には、次のものがあります。
MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
UINavigationController *navigationController = [delegate navigationController];
[navigationController popViewControllerAnimated:YES];
また、そのビュー(theSecondViewController)に対していくつかの作業を行う関数の最後にありますが、別のビュー(theViewController)をロードします。
私の問題は、ViewControllerでこの同じコードを使用すると機能しなくなることです。まあ、ちょっと。私はそれが通り抜けてコントローラーをポップオフすると思いますが、ビュー(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で機能しますが、ViewControllerでは機能しません