我有一个视图控制器,它以viewDidLoad
播放视频。我有一个观察者,负责检查视频何时结束以及何时检测到视频结束,该方法被调用,该方法将视图控制器推入堆栈。但是,调用此方法时,在控制台中会出现以下错误:*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 setView:]: unrecognized selector sent to instance 0xc6ef8e0'
我使用的代码如下所示:
....
....
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(advanceToNextView) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
....
....
- (void) advanceToNextView {
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"spoonVC"];
[self.navigationController pushViewController:controller animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
}
我不知道我在做什么错。我已经检查并仔细检查了情节提要标识符是否正确。
最佳答案
替换您的此代码:
[self.navigationController pushViewController:controller animated:NO];
通过:
[self.navigationController pushViewController:controller animated:YES];
关于iphone - 推送 View Controller 时应用崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12333417/