You are not allowed to use retain
with ARC. However it still works the same in the background as without ARC (and as described in that documentation you linked), but the retain
and release
calls are added by the compiler as necessary. You don't have to deal with that.
This setter:
- (void)setCount:(NSNumber *)newCount {
[newCount retain];
[_count release];
// Make the new assignment.
_count = newCount;
}
should look like this, when using ARC:
- (void)setCount:(NSNumber *)newCount {
// Make the new assignment.
_count = newCount;
}