How do I rewrite this method for ARC?
- (KTThumbView *)dequeueReusableThumbView
{
KTThumbView *thumbView = [reusableThumbViews_ anyObject];
if (thumbView != nil) {
// The only object retaining the view is the
// reusableThumbViews set, so we retain/autorelease
// it before returning it so that it's not immediately
// deallocated when removed form the set.
[[thumbView retain] autorelease];
[reusableThumbViews_ removeObject:thumbView];
}
return thumbView;
}
The automatic ARC migrator gives me this error:
[rewriter] it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately
Just remove the
[[thumbView retain] autorelease];line. The first line will make a strong reference guaranteeing its around as needed.