Safe NSArray access
I expected objectAtIndex:
to return a retained and autoreleased object for my use, but my tests with autorelease pools indicate they do not.
This being the case, how do I protect myself against another thread removing an object from an array after I retrieve its reference using o开发者_如何学GobjectAtIndex but before I have a chance to use or retain that reference?
Synchronize access to the array, as you should any access to resources shared across threads.
精彩评论