开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜