fellow StackOverflow user告诉我在释放属性时不应该使用getter方法:
@property(nonatmic, retain) Type* variable;
@synthesize variable;
// wrong
[self.variable release];
// right
[variable release];
他没有详细解释原因。它们在我看来是一样的。My iOS book说,属性上的getter将如下所示:
- (id)variable {
return variable;
}
那么,这不意味着[self variable]
、self.variable
和variable
都是一样的吗?
https://stackoverflow.com/questions/7262268
复制相似问题