OGeek|极客世界-中国程序员成长平台

标题: iphone - 推送 View Controller 时应用程序崩溃 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 16:12
标题: iphone - 推送 View Controller 时应用程序崩溃

我有一个在 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-推荐答案


替换您的此代码:

[self.navigationController pushViewController:controller animated:NO];

作者:

 [self.navigationController pushViewController:controller animated:YES];

关于iphone - 推送 View Controller 时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12333417/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://www.ogeek.cn/) Powered by Discuz! X3.4