在 NSKVODallocateBreak 设置断点

发布于 2024-12-05 04:04:47 字数 309 浏览 0 评论 0原文

我正在使用地图套件并创建了一个注释。由于此错误,我正在尝试查找我的错误:

类 AddressAnnotation 的实例 0x1b7ac0 已被释放,而键值观察者仍向其注册。观察信息被泄露,甚至可能被错误地附加到其他物体上。在 NSKVODallocateBreak 上设置断点以在调试器中停止。以下是当前的观测信息:

我不确定要设置断点的 NSKVODallocateBreak 在哪里。我以为我可以使用 Instruments 来调试它,但是当我尝试时,它崩溃了,并且没有给我任何崩溃位置的指示。有什么想法吗?

I am playing around with the map kit and I created an annotation. I am trying to find my bug due to this error:

An instance 0x1b7ac0 of class AddressAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:

I'm not sure where that NSKVODeallocateBreak to set a breakpoint at is. I thought I could use Instruments to debug it, but when I try, it crashes without giving me any indication to where it crashed. Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

清眉祭 2024-12-12 04:04:47

您可能在代码中执行类似的操作:

[addressAnnotation addObserver:self
forKeyPath:kSelectedAnnotationObserverKeyPath
选项:NSKeyValueObservingOptionNew
context:@"selectedOrDeselected"];

这意味着您正在注册一个观察者来查找注释何时被选择。

当注释从地图中删除时,您应该删除观察者,如下所示:

[addressAnnotation removeObserver:self forKeyPath:kSelectedAnnotationObserverKeyPath];

这应该会消除错误。如果没有,并且您想调试它,那么您当然应该在 NSKVODeallocateBreak 上设置断点。为此,请打开运行菜单,管理断点添加符号断点,输入NSKVODallocateBreak,然后你是。

希望有帮助!

You are probably doing something like this in your code:

[addressAnnotation addObserver:self
forKeyPath:kSelectedAnnotationObserverKeyPath
options:NSKeyValueObservingOptionNew
context:@"selectedOrDeselected"];

That means that you are registering an observer to find out when an annotation has been selected.

You should remove the observer when the annotation gets removed from the map, like this:

[addressAnnotation removeObserver:self forKeyPath:kSelectedAnnotationObserverKeyPath];

That should remove the error. If it doesn't and you want to debug it, you certainly should set a breakpoint on NSKVODeallocateBreak. In order to do this, open the Run menu, Manage Breakpoints, Add symbolic breakpoint, enter NSKVODeallocateBreak and there you are.

Hope it helps!

爱冒险 2024-12-12 04:04:47

要使用 LLDB 在此处设置断点,请启动应用程序,然后暂停它,并在 LLDB 调试提示符处写入:

breakpoint set --name NSKVODeallocateBreak

现在您已在那里设置了断点。希望这可以帮助您找到问题,这可能是@frowing 所描述的类型

To set a breakpoint here with LLDB, start your app, then pause it, and at the LLDB debug prompt write:

breakpoint set --name NSKVODeallocateBreak

Now you've got a breakpoint set there. Hopefully this should help you find the problem, which probably will be of the kind described by @frowing

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