我有一个应用程序,我收集了我无法重现的崩溃报告。我有一个视图控制器,它只是[super didReceiveMemoryWarning]
在处理自己的内存警告时调用(是的,我知道我不需要这样做,但这也不能解决我现在遇到的问题)。一旦父 UIViewController 尝试调用 purgeMemoryForReason 它就会崩溃
这是相关的跟踪信息:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x90000008
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x361dbf78 objc_msgSend + 16
1 UIKit 0x31fbf499 -[UIViewController purgeMemoryForReason:] + 65
2 MyApp 0x00016f0d -[AttributesViewController didReceiveMemoryWarning] (AttributesViewController.m:76)
3 Foundation 0x30c5b4ff __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 19
4 CoreFoundation 0x34d86547 ___CFXNotificationPost_block_invoke_0 + 71
5 CoreFoundation 0x34d12097 _CFXNotificationPost + 1407
6 Foundation 0x30bcf3eb -[NSNotificationCenter postNotificationName:object:userInfo:] + 67
7 Foundation 0x30bd0c1b -[NSNotificationCenter postNotificationName:object:] + 31
8 UIKit 0x31f8a271 -[UIApplication _performMemoryWarning] + 81
9 UIKit 0x31f8a36b -[UIApplication _receivedMemoryNotification] + 175
10 libdispatch.dylib 0x30de42e1 _dispatch_source_invoke + 517
11 libdispatch.dylib 0x30de1b81 _dispatch_queue_invoke$VARIANT$mp + 53
12 libdispatch.dylib 0x30de1ec1 _dispatch_main_queue_callback_4CF$VARIANT$mp + 157
13 CoreFoundation 0x34d8d2ad __CFRunLoopRun + 1269
14 CoreFoundation 0x34d104a5 CFRunLoopRunSpecific + 301
15 CoreFoundation 0x34d1036d CFRunLoopRunInMode + 105
16 GraphicsServices 0x3600c439 GSEventRunModal + 137
17 UIKit 0x31e06e7d UIApplicationMain + 1081
18 MyApp 0x0000243b main (main.m:15)
我希望我能重现该错误,但无论我在测试设备或模拟器上触发内存警告多少次,我都无法让这种情况发生。任何关于我可能寻找的帮助将不胜感激,因为我已经尝试寻找并且没有找到任何指向我潜在问题的信息。谢谢!
编辑:正如我所说,我没有做任何事情didReceiveMemoryWarning
:
- (void) didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
是的,我知道我不需要这样做。我计划删除此代码(我什至不知道为什么我仍然在其中),但我想确保我已修复问题的根源。我也没有viewDidUnload
实现AttributesViewController
。我还应该提到我正在使用 ARC,但我不确定这是否重要。
从我收到的反馈来看,使用相机时会出现内存警告(UIImagePickerController
使用源类型UIImagePickerControllerSourceTypeCamera
)。AttributesViewController
由视图控制器以模态方式呈现,比呈现的层次高两层UIImagePickerController
,它们不共享任何对象或其他数据。我知道相机经常会引起内存警告,所以我不确定它UIImagePickerController
是否与内存消耗有关。
我将 Xcode 设置为始终运行分析器,并且没有出现任何问题。我还通过 Zombies and Leaks 工具运行了代码,但无法重现问题或发现任何其他问题。