How to get the reference count of an NSObject?

前端 未结 3 1202
情深已故
情深已故 2020-11-29 10:43

Is there a way to fetch the current reference count for an NSObject (i.e. NSString)?

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 11:23

    using CFGetRetainCount function

    Example :

    print(CFGetRetainCount(object))
    

    Read more here.

提交回复
热议问题