我想将一个对象添加到 NSMutableArray 中:
NSLog(@"Object text: %@", object.text);
NSLog(@"Object: %@", object);
[appdelegate.objects addObject:object];
NSLog(@"Objects array size: %i", [appdelegate.objects count]);
这是输出:
Object text: This is the text
Object: <Object: 0x6e762c0>
Objects array size: 0
这怎么可能,我添加了一个对象,在下一行,它仍然是空的。NSMutableArray
is not ,因为那nil
会引发异常。
有人猜吗?