嗨,我正面临 Linux / GNUstep 的问题。我的 NSMutableArray(s) 似乎没有保留任何添加的对象。他们不应该吗?例子:
NSString * str = @"test";
NSMutableArray * arr = [[NSMutableArray alloc] init];
NSLog(@"before add retainCount: %d", [str retainCount]);
[arr addObject: str];
NSLog(@"after add retainCount: %d", [str retainCount]);
输出:
before add retainCount: 1
after add retainCount: 1