您可以将保留计数发送到NSLog来帮助学习吗? [英] Can you send retain counts to NSLog to aid learning?

查看:72
本文介绍了您可以将保留计数发送到NSLog来帮助学习吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否仍然可以使用NSLog来显示对象的保留计数.我只想将它们打印出来到控制台,以帮助了解保留/释放如何以一些简单的代码工作?

Just curious if there is anyway to display an objects retain count using NSLog. I just want to print them out to console to help learn how retain/release is working in some simple code?

欢呼-加里-

推荐答案

不仅可能,而且非常容易:

Not only is it possible, it's very easy too:

NSLog(@"retain count=%d",[obj retainCount]);

这篇关于您可以将保留计数发送到NSLog来帮助学习吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆