Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I have the following code in my app right now. My app works, but what I really want is for playerItemDidFinishPlaying to be executed on the main thread. I guess I could just create a new method that will be called instead, and use the performSelectorOnMainThread method.

So, instead of this:

Code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];

I'd have this:
Code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(someMethod) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];

-(void)someMethod
{
[self performSelectorOnMainThread:@selector(playerItemDiDFinishPlaying)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.