我有一个在 viewDidLoad 中播放视频的 View Controller 。我有一个观察者检查视频何时完成以及当它检测到视频完成时调用一个方法,该方法将 View Controller 插入堆栈。但是,当调用此方法时,控制台中会出现以下错误:
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSPathStore2 setView:]: unrecognized selector sent to instance 0xc6ef8e0”
我使用的代码如下所示:
....
....
[[NSNotificationCenter defaultCenter] addObserver:self selectorselector(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];
}
我不知道我做错了什么。我已经检查并再次检查了 Storyboard标识符是否正确。
Best Answer-推荐答案 strong>
替换您的此代码:
[self.navigationController pushViewController:controller animated:NO];
作者:
[self.navigationController pushViewController:controller animated:YES];
关于iphone - 推送 View Controller 时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/12333417/
|