viewDidLoad 或 viewDidDisappear 上的 Xcode 4.2 调试将以 EXC_BAD_ACCESS 结束

发布于 2024-12-10 11:27:37 字数 721 浏览 0 评论 0原文

viewDidLoadviewDidDisappear 上进行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

请别遗忘我 2024-12-17 11:27:37

您必须始终在您重写的所有 viewWill...viewDid... 方法中的某个时刻调用 super。例如,

- (void) viewDidDisappear:(BOOL)animated {
        NSLog(@"View did disapear");
        [super viewDidDisappear:animated];
}

You must always call through to super at some point in all of the viewWill... or viewDid... methods that you override. For example,

- (void) viewDidDisappear:(BOOL)animated {
        NSLog(@"View did disapear");
        [super viewDidDisappear:animated];
}
一片旧的回忆 2024-12-17 11:27:37

如果您重写此方法,则必须在实现中的某个时刻调用 super。

这是来自文档的,我不知道这是否是导致您的错误访问的问题,但这至少是您必须修复的问题。

If you override this method, you must call super at some point in your implementation.

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.

£烟消云散 2024-12-17 11:27:37

您对您提供的代码没有多大帮助。

设置 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

oО清风挽发oО 2024-12-17 11:27:37

我在 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.

恋竹姑娘 2024-12-17 11:27:37

我在这里看到略有不同的问题。就我而言(SnowLeopard 10.6.8、XCode 4.2、LLVM 3.0),它在制动点停止,但 XCode 不显示任何调试信息。我可以在 GDB 中看到我的堆栈竞赛,但本地值混乱。有趣的是,我尝试使用performSelectorOnMainThread:它可以恢复XCode调试功能,但有些东西会破坏活动帧值。

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
        [self performSelectorOnMainThread:@selector(_destroyMarketBrowser) withObject:nil waitUntilDone:YES];

顺便说一句

:模拟器中一切正常,问题仅出现在真实设备(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.

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
        [self performSelectorOnMainThread:@selector(_destroyMarketBrowser) withObject:nil waitUntilDone:YES];

}

Btw: Everything works fine in simulator, the problem only occurs on real devices (5.0.1 or 5.1 Beta2)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文