ios - 在Objective C中推送segue时出现无法识别的选择器错误
问题描述
我有一个应用程序,它有一个侧边栏菜单(一个 UITableView),其中不同的行通过(推送)Segue 与主视图控制器单独连接。
只有其中一个不起作用,所以当我点击它时,我会收到以下消息:
****由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[MainTabBarController topViewController]:无法识别的选择器发送到实例 0x14880ce00”以未捕获的 NSException 类型异常终止*
在 SideBarViewController 中,这是导致崩溃的代码部分:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSLog(@"[segue identifier]: %@",[segue identifier]);
if ([[segue identifier] isEqualToString:@"sync"]) {
MainViewController *mainViewSync= (MainViewController *)[[segue destinationViewController] topViewController];
mainViewSync.sync = 1;
}}
我该如何解决?
解决方案
推荐阅读
- html - Italic tag not being formatted in Github Pages
- python - 使用 Python 调用 JSON API
- firebase - 如何将 Google App Engine 与 Firebase 结合使用
- php - Symfony 翻译忽略参数中的花括号
- wordpress - 如何在 wordpress 主题中包含 json 清单文件
- python - “while”循环未按预期运行
- java - Spring批处理GZIP ItemWriter/ItemReader
- python - 如何使用 egg 安装 scikit-image?
- python - 字符从摩尔斯电码错误地翻译成英文
- ios - SDWebImage 不适用于 Firebase 存储