0

我收到以下错误消息...

由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[YTPlayerView playerView]:无法识别的选择器发送到实例 0x7fd77bd41f80”

这是我的代码..

- (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];

   }
4

1 回答 1

0

您的代码在此语句中失败

[_playerView performSelector:@selector(playerView) withObject:nil afterDelay:0.1];

该语句预计您的对象将在延迟 0.1 秒后_playerView调用该方法。playerView但是该类YTPlayerView没有名为playerView. 您可能想要检查实际的方法名称并将其替换为选择器名称。

于 2017-05-22T06:17:05.620 回答