viewDidLoad 或 viewDidDisappear 上的 Xcode 4.2 调试将以 EXC_BAD_ACCESS 结束
在 viewDidLoad
或 viewDidDisappear
上进行 Xcode 4.2 调试将在 EXC_BAD_ACCESS
上结束
它在该断点处中断,但在继续(“继续程序执行”)时它在线程 1(0 开始)上返回:EXC_BAD_ACCESS(代码=1,地址=0x....)。在早期版本中并没有发生这种情况。
有人遇到同样的错误吗?有人知道如何处理吗?
该示例的代码很简单:
- (void) viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
NSLog(@"View did dissapear");
}
在断点上进行调试(使用 NSLog 行),然后点击继续,它将在 EXC_BAD_ACCESS 上结束。如果没有断点,那么一切正常。
我正在使用 Xcode 4.2 Build 4D199 (OS X Lion 10.7.2)。使用 LLDB 调试器。
更新:在所有异常中放置一个中断,它总是以线程 8 结束:EXC_BAD_ACCESS - 0x1f43:movl(%ebx),%eax - 第 0 行:开始......
更新 2:用 Xcode 玩弄,我真的不知道不知道为什么,但知道它有效。没有更改代码...嗯...奇怪...
Xcode 4.2 debugging on a viewDidLoad
or viewDidDisappear
will end on a EXC_BAD_ACCESS
It breaks on that breakpoint but when continuing ("Continue program execution") it returns a: EXC_BAD_ACCESS (code=1, address=0x....) on Thread 1 (0 start). That did not happen in earlier versions.
Someone getting the same error? Somebody knows how to deal with it?
Code for the example would be a simple:
- (void) viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
NSLog(@"View did dissapear");
}
When debugging on breakpoint (line with NSLog) it and then hitting on continue it will end on that EXC_BAD_ACCESS. If no breakpoint then everything works fine.
I am working with Xcode 4.2 Build 4D199 (OS X Lion 10.7.2). Using LLDB debugger.
UPDATE: put a break in all exceptions and it always ends on a Thread 8: EXC_BAD_ACCESS - 0x1f43: movl (%ebx), %eax - line 0: start....
UPDATE 2: played around with Xcode and I really don´t know why but know it works. No code changed... hmmm... strange...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须始终在您重写的所有
viewWill...
或viewDid...
方法中的某个时刻调用super
。例如,You must always call through to
super
at some point in all of theviewWill...
orviewDid...
methods that you override. For example,这是来自文档的,我不知道这是否是导致您的错误访问的问题,但这至少是您必须修复的问题。
It's from the doc, I don't know if it's the problem that cause your BAD ACCES, but it's at least something you have to fix.
您对您提供的代码没有多大帮助。
设置 malloc_error_break 并启用僵尸,看看是否会导致某些问题
You are not helping much with that code you provided.
set an malloc_error_break and enable zombies and see if that leads to something
我在 viewDidDisappear:animated 上收到了同样的错误 - 事实证明我有一个拼写错误调用 [self viewDidDisappear:animated];而不是 [super viewDidDisappear:animated];
简单的修复,但一开始不是很明显。我很惊讶它没有给我警告。
I was recieving the same error on viewDidDisappear:animated - it turned out that I had a typo calling [self viewDidDisappear:animated]; instead of [super viewDidDisappear:animated];
Simple fix but not very noticeable at first. I was surprised it didn't give me a warning.
我在这里看到略有不同的问题。就我而言(SnowLeopard 10.6.8、XCode 4.2、LLVM 3.0),它在制动点停止,但 XCode 不显示任何调试信息。我可以在 GDB 中看到我的堆栈竞赛,但本地值混乱。有趣的是,我尝试使用performSelectorOnMainThread:它可以恢复XCode调试功能,但有些东西会破坏活动帧值。
顺便说一句
:模拟器中一切正常,问题仅出现在真实设备(5.0.1 或 5.1 Beta2)上
I see slightly different issue here. In my case(SnowLeopard 10.6.8, XCode 4.2, LLVM 3.0) it stops at the brake point, but XCode doesnt display any debugging info. I can see my stackrace in GDB fine, but local values are messed up. Interestingly i tried to use
performSelectorOnMainThread:
it can restore XCode debugging functions, but something corrupts active frame values.}
Btw: Everything works fine in simulator, the problem only occurs on real devices (5.0.1 or 5.1 Beta2)