Possible Duplicate:
strong / weak / retain / unsafe_unretained / assign
what's difference between unsafe_unretained and weak and assign under ARC? thanks a lot.
Possible Duplicate:
strong / weak / retain / unsafe_unretained / assign
what's difference between unsafe_unretained and weak and assign under ARC? thanks a lot.
From the documentation:
weak specifies a reference that does not keep the referenced object alive. A weak reference is set to nil when there are no strong references to the object.
Assign
is identical to weak
except that it does not set pointers to deallocated instances to nil, potentially leaving dangling pointers. Assign
and unsafe_unretained
are identical in usage.
EDIT: Oh my, it seems I massively confused property attributes and ownership qualifiers; my original answer was the correct one. Assign
and unsafe_unretained
are both property attributes that imply the ownership qualifier __unsafe_unretained
for their backing instance variables. Use unsafe_unretained
for backwards compatibility with iOS 4 and assign
otherwise.