EXC_BAD_ACCESS在设备上,但罚款在模拟器 [英] EXC_BAD_ACCESS on device, but fine on Simulator
问题描述
我有一个滚动视图应用程序在模拟器上运行良好,但是,当安装在设备上时,它给我一个EXC_BAD_ACCESS,当我试图滚动一页。我已经运行它通过仪器与分配和泄漏,但没有什么是泄漏,没有僵尸消息...我只是好奇什么可能会导致这样的差异在模拟器VS设备?任何调试此方法,因为我的符号崩溃日志(部分下面),似乎不是很象征。
I have a scroll view app which runs fine on the simulator, however, when installed on the device, it gives me an EXC_BAD_ACCESS, when i attempt to scroll one page. I have ran it through Instruments with Allocations and Leaks, but nothing is leaked and no zombies are messaged... i'm just curious what could cause such a difference in simulator vs device? Any ways to debug this, since my symbolicated crash log (partial below), doesn't seem to be very symbolicated.
异常类型:EXC_BAD_ACCESS(SIGBUS)
异常代码:KERN_PROTECTION_FAILURE在0x0000000f
崩溃的主题:0
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000f
Crashed Thread: 0
线程0崩溃:
0 libobjc。 A.dylib 0x0000286e objc_msgSend + 18
1 MyApp 0x00004fee 0x1000 + 16366
2 UIKit 0x000668f4 - [UIViewController view] + 104
3 MyApp 0x00009716 0x1000 + 34582
4 MyApp 0x0000960c 0x1000 + 34316
5 UIKit 0x0001426c - [UIScrollView setContentOffset:] + 344
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000286e objc_msgSend + 18
1 MyApp 0x00004fee 0x1000 + 16366
2 UIKit 0x000668f4 -[UIViewController view] + 104
3 MyApp 0x00009716 0x1000 + 34582
4 MyApp 0x0000960c 0x1000 + 34316
5 UIKit 0x0001426c -[UIScrollView setContentOffset:] + 344
感谢
推荐答案
你在模拟器中的代码可能有错误,但不是触发EXC_BAD_ACCESS只是运气,你解引用的指针不在未映射内存中。
Your code in the simulator could have the bug, but isn't triggering EXC_BAD_ACCESS by just the luck that a pointer that you dereference is not in unmapped memory. A pointer could be bad, and accessed, but not detected -- it's still a bug.
你已经检查过,没有僵尸是消息,这将是一个错误,我的第一个建议。
You have already checked to see that no Zombies are messaged, which would have been my first suggestion.
接下来要做的是启用Guard Malloc - 然后阅读此
The next thing to do is Enable Guard Malloc -- and then read this
a href =http://developer.apple.com/iphone/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html =nofollow noreferrer> http://developer.apple.com/iphone /library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
http://developer.apple.com/iphone/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
您只能在模拟器中执行此操作 - 您的目标是使用
You can only do this in the simulator -- your goal is to use the extra-sensitive heap to make the bug throw EXC_BAD_ACCESS in the simulator.
在文章中:
- 查看如何在GDB中设置变量
- 阅读检测堆腐败部分
这篇关于EXC_BAD_ACCESS在设备上,但罚款在模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!