Handling retain with ARC enabled?
I want to extend an NSMutableArray with queue like selectors one such is
- (id)dequeue {
id obj = nil;
if ([self count] > 0) {
id obj = [self objectAtIndex:0];
if (obj != nil) {
[self removeObjectAtIndex:0];
}
}
return obj;
}
Problem is that I have ARC enabled and the data that obj points at is
released at removeObjectAtIndex: so dequeue always returns null.
What's an elegant way to work around this or is my approach completely wrong?
No comments:
Post a Comment