Why has NSNumber such strange retainCounts?

后端 未结 5 604
星月不相逢
星月不相逢 2020-11-28 16:36
NSNumber* n = [[NSNumber alloc] initWithInt:100];
NSNumber* n1 = n;

In the code above, why is the value of n\'s retainCount set to 2? In the second

5条回答
  •  悲&欢浪女
    2020-11-28 17:30

    Stop. Just stop. Never look at the retainCount of an object. Ever. It should never have been API and available. You're asking for pain.

    There's too much going on for retainCount to be meaningful.

提交回复
热议问题