xcode iPhone - 如何找到它所指的对象?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5213696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:23:41  来源:igfitidea点击:

iPhone - how to find what object is it referring?

iphonexcodedebugging

提问by DuckDucking

What's the point of Xcode showing the object address in messages like

Xcode 在消息中显示对象地址有什么意义

[CALayer retain]: message sent to deallocated instance 0x1bc320

[CALayer retain]:消息发送到释放实例 0x1bc320

if when it happens you cannot find which object 0x1bc320 is?

如果发生时您找不到 0x1bc320 是哪个对象?

Every time I see stuff like that I search the debugger for all objects that I can find and I never find which object is the one it is referring on the error message.

每次我看到类似的东西时,我都会在调试器中搜索我能找到的所有对象,但我从来没有找到哪个对象是错误消息中引用的对象。

wasn't it logical just to say [CALayer retain]: message sent to deallocated instance.

仅仅说[CALayer retain]: message sent to deallocated instance是不是合乎逻辑

Is that any way to find the object when that happens? Something I can type on console or something?

发生这种情况时,有没有办法找到对象?我可以在控制台上输入什么?

thanks

谢谢

回答by Marc W

Just type po 0x1bc320. You can also use allocations tracking in Instruments with NSZombietracking enabled. That will halt the app and show you the full lifecycle of the zombied object and who called it after deallocation.

只需输入po 0x1bc320. 您还可以在NSZombie启用跟踪的 Instruments 中使用分配跟踪。这将停止应用程序并向您显示僵尸对象的完整生命周期以及在释放后调用它的人。