Retain/Autorelease in Cocoa Getters
Someone asked me: “Why do some getters do:
- (id)object;
{
return _object;
}
{
return _object;
}
and others do:
- (id)object;
{
return [[_object retain] autorelease];
}
{
return [[_object retain] autorelease];
}
…?”
The difference comes up in a special case which can cause a crash.
Read more »







Comments(0)