[self performSelector:@selector(playAnnouncement) withObject:nil afterDelay:2];
and then it's really important to add the NSAutoreleasePool to the selector method, like so...
-(void)playAnnouncement{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
... code to play the announcement ...
[pool release];
}
And there's that.
really? Even inside the Main Thread? Whoa, that's weird! When we call perform selector, actually what happens? You know?
ReplyDeletei believe it's necessary to use NSAutoReleasePool for performSelector calls because the invocation will happen in a new thread...
ReplyDeletehowever, i do NOT believe you need to use NSAutoReleasePool when calling performSelectorOnMainThread, since the invocation happens in the same thread.
i think that's right, does that make sense?