【发布时间】:2010-11-06 05:18:41
【问题描述】:
我知道一旦你释放了一个对象,你就不应该使用它,因为它已经不在内存中了,它会导致错误。
但是通过this Apple指南阅读,我找到了这段代码,并且之前也看到过,但我只是将[object release]移动到我的代码末尾,以免出错。但似乎它被接受并且有效。那么,为什么会这样呢?发布后如何继续设置变量为dateAttribute?
(第 3 行是有问题的):
NSMutableArray *runProperties = [NSMutableArray array];
NSAttributeDescription *dateAttribute = [[NSAttributeDescription alloc] init];
[runProperties addObject:dateAttribute];
[dateAttribute release];
[dateAttribute setName:@"date"];
[dateAttribute setAttributeType:NSDateAttributeType];
[dateAttribute setOptional:NO];
【问题讨论】:
标签: iphone ios release-management