Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何获取 NSObject 的引用计数?
有没有办法找出任何给定实例中单个变量的引用计数。我尝试使用堆镜头,它给出了流中的整体引用计数。
谢谢
您可以使用该-retainCount方法获取 的保留计数NSObject,但请记住,您几乎肯定不会取回任何有用的信息。对象可以由系统和框架的各个部分保留,因此您经常会得到意想不到的结果。
-retainCount
NSObject