So before ARC (Automatic Reference Counting) was a thing, you would see retain
and release
everywhere.
When you allocate an object, you had to retain
it, to increment the retain count. And if you ever called release
, you would decrement the retain count. If the retain count ever hit 0, the object was released, -dealloc
would be called
Now with ARC, the retain
and release
instructions are compiled in, based off of attributes of your object (strong
, weak
) you can read more about that here: Objective-C ARC: strong vs retain and weak vs assign
Anyways point being that your line there, as danh said, does nothing. Because [NSUserDefaults standardUserDefaults]
is a singleton, there is no point in incrementing the retain count, because there's no threat of it being released from under you.
Although I don't think it is the weirdest thing to assign the standardUserDefaults
to a local pointer, it would be just as effective to access the singleton every time you needed the standard defaults