NavigationControllerと積み重ねたUIViewControllerのセットがあります。この山の最後の要素に到達したら、popToRootViewControllerを実行します。このパイルを再度作成しようとすると(そして、はい、ビューでメモリの負荷を使用します)、システムは、navigationcontrollerパイル内の以前のオブジェクトの1つに対してmemoryWarningとviewDidUnloadを呼び出します。私はこれが大丈夫であることを知っています、それがいつメモリ警告を生成するか、またはviewDidUnloadを呼び出すかを制御することはできません。問題は、何らかの理由で「self」がすでに割り当てられていないため(NSZombie)、プロパティをnilに設定してメモリを解放できないことです。そうすると、割り当て解除されたインスタンスにメッセージが送信されます。
2つのこと:
(a)rootにポップしたときに、ナビゲーションコントローラーからすべてのサブビューを強制的に解放して、より「メモリフレンドリー」にする方法はありますか?
(b)割り当てられていないクラスのviewDidUnloadを呼び出すのはなぜですか?
これが私が得るスタックトレースです:
#0 0x33a69910 in ___forwarding___ ()
#1 0x33a69860 in __forwarding_prep_0___ ()
#2 0x0000e4a2 in -[MyViewController viewDidUnload] at /Users/Fernando/src/Classes/MyViewController.m:866
#3 0x32105484 in -[UIViewController unloadViewForced:] ()
#4 0x321053d0 in -[UIViewController unloadViewIfReloadable] ()
#5 0x3219ede4 in -[UIViewController purgeMemoryForReason:] ()
#6 0x3219ee04 in -[UIViewController didReceiveMemoryWarning] ()
#7 0x0000e426 in -[MyViewController didReceiveMemoryWarning] ()
#8 0x3219ee1a in -[UIViewController _didReceiveMemoryWarning:] ()
#9 0x3362d622 in _nsnote_callback ()
#10 0x33a47122 in __CFXNotificationPost_old ()
#11 0x33a46dc2 in _CFXNotificationPostNotification ()
#12 0x3361cd22 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#13 0x33626240 in -[NSNotificationCenter postNotificationName:object:] ()
#14 0x32167da8 in -[UIApplication _performMemoryWarning] ()
#15 0x321689ca in -[UIApplication _receivedMemoryNotification] ()
#16 0x32165776 in _memoryStatusChanged ()
#17 0x33a770cc in __CFNotificationCenterDarwinCallBack ()
#18 0x33a5dbe6 in __CFMachPortPerform ()
#19 0x33a556fe in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#20 0x33a556c2 in __CFRunLoopDoSource1 ()
#21 0x33a47f7c in __CFRunLoopRun ()
#22 0x33a47c86 in CFRunLoopRunSpecific ()
#23 0x33a47b8e in CFRunLoopRunInMode ()
#24 0x33b0e4aa in GSEventRunModal ()
#25 0x33b0e556 in GSEventRun ()
#26 0x32099328 in -[UIApplication _run] ()
#27 0x32096e92 in UIApplicationMain ()
#28 0x00002c72 in main at /Users/Fernando/src/main.m:13
どんな助け/提案も本当にありがたいです!
ありがとう、
フェルナンド