As title. Do I need to call NSAutoReleasePool after calling performSelector:withObject:afterDelay?
I think performSelector:withObject:afterDelay: is not on main thread, so it is necessary to add autorelease pool. Is that correct?
ex:
[self performSelector:@selector(update) withObject:nil afterDelay:0.1];
-(void) update {
NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init]; // Is it necessary
...
[pool drain];
}
Thanks!
No. This method executes the supplied selector on the same thread/run loop on which you called it, using an NSTimer scheduled for that actual run loop. You don’t need to worry about it.