Assuming you are using ARC, the reference obtained in t
is a strong one to the object that existed at the time you retrieved it. If some other thread replaces the object, t
would still reference the original object, and that object would stick around until t
goes out of scope.
However t
being a mutable array, some other thread could get its own reference and modify the mutable array itself by adding and removing objects. Those changes would be visible to your t
, because it is the same object.
That is important, because if you try to iterate over the array while some other thread modifies it, you may encounter all kinds of unexpected results. Depending on your Xcode version it might produces warnings during compile and/or runtime to help identify those scenarios. One pattern to avoid the array changing from under you is to create an immutable copy, like NSArray *immutableT=[t copy]
. This produces a shallow copy of the array that is immune to changes to the original mutable array, so you can safely iterate over immutableT
.