私が知っている限り、オブジェクトの保持カウントが0になると、そのdeallocが呼び出されます。しかし、-1として保持カウントを取得しています。どういう意味ですか?方法stringWithStringによって返さなぜretainCountが-1を返すのですか?
retain count of name = -1
文字列:: GETリリース
私は、次のコード -
Demo *obj1 = [[Demo alloc] init];
NSString *s = [[NSString alloc] initWithString:@"mithilesh"];
NSString *s1 = [NSString stringWithString:s];
[s release];
object_setInstanceVariable(obj1, [propertyName cString], s1);
//printing retain count
NSLog(@"retain count of name = %i",[obj1.name retainCount]);
出力を使用していますか?
あなたは何をしようとしていますか:/ –
[なぜNSNumberが間違ってカウントするのですか?](http://stackoverflow.com/questions/8340050/why-does-nsnumber-wrong -count-a-retaincount) –