gpt4 book ai didi

iphone - iOS 4.2 操作系统正在调用 Zombie 的 viewDidUnload (未分配的类)

转载 作者:行者123 更新时间:2023-12-03 19:59:53 26 4
gpt4 key购买 nike

我有一组 UIViewController,我用 NavigationController 堆积起来。当我到达这一堆的最后一个元素时,我执行 popToRootViewController。如果我尝试再次创建这一堆(是的,我确实在 View 中使用了一些内存负载),系统会为导航 Controller 堆中我之前的对象之一调用 MemoryWarning 和 viewDidUnload 。我知道这没关系,我无法控制它何时会生成内存警告或调用 viewDidUnload。问题是,由于某种原因,当它到达那里时,“self”已经未分配(NSZombie),所以我无法将我的属性设置为 nil 并释放内存。如果这样做,我将收到一条发送到已释放实例的消息。

有两件事:

(a) 当我弹出到根目录时,有没有办法强制释放导航 Controller 中的所有 subview ,以便我可以更加“内存友好”?

(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

非常感谢任何帮助/建议!

谢谢

费尔南多

最佳答案

(a) Is there a way for me to force releasing all subviews from navigationcontroller when I pop to root so I can be more 'memory friendly'?

也许你可以获取 popToRootViewController 的返回值并释放它们?

(b) Why would it call viewDidUnload of an unallocated class?

不确定,如果可能的话,您可以分享您的代码吗?

关于iphone - iOS 4.2 操作系统正在调用 Zombie 的 viewDidUnload (未分配的类),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5143263/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com