I am getting the following error message...
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[YTPlayerView playerView]: unrecognized selector sent to instance 0x7fd77bd41f80'
and here is my code..
- (void)applicationDidEnterBackground:(NSNotification *)notification
{
[_playerView performSelector:@selector(playerView) withObject:nil afterDelay:0.1];
}
- (IBAction)didTapPlayPause:(id)sender {
self.btnPlayPause.selected = !self.btnPlayPause.selected;
if (self.btnPlayPause.selected)
{
self.title=self.strngvideotitle;
self.playerView=[[YTPlayerView alloc]initWithFrame:CGRectMake(0,0,375,290)];
[self.playerView loadWithVideoId:self.strngvideoId];
[self.view addSubview:_playerView];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
}
Your code fails at this statement
The statement expects that your
_playerView
object will call the methodplayerView
after a delay of 0.1 seconds. But the classYTPlayerView
does not have a method calledplayerView
. You might want to check the actual method name and replace it in the selector name.