我收到以下错误消息...
由于未捕获的异常而终止应用 '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];
}
答案 0 :(得分:0)
您的代码在此声明中失败
[_playerView performSelector:@selector(playerView) withObject:nil afterDelay:0.1];
该语句希望您的_playerView
对象在延迟0.1秒后调用方法playerView
。但是类YTPlayerView
没有名为playerView
的方法。您可能想要检查实际的方法名称并将其替换为选择器名称。