【发布时间】:2015-06-04 09:00:28
【问题描述】:
XMPP
使用 tableview 我正在尝试使用特定用户名转到下一个视图控制器。所以为此我已经正确实现了 UItablevie 的didselectrowatIndexpath。但是当我点击用户名时会出现这样的错误。
应用程序试图在目标上推送一个 nil 视图控制器。
"。 2015-06-04 14:22:51.063
我已经像这样在 appdelegate.m 中声明了故事板。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
ChatViewController *ChatViewController1 = [[ChatViewController alloc]init];
self.storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
return YES;
}
这是我的 tableview 的 Delegate 方法。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tblvwbuddy deselectRowAtIndexPath:indexPath animated:YES];
XMPPUserCoreDataStorageObject *user = nil;
user = [[self fetchedResultsController] objectAtIndexPath:indexPath];
ChathistryViewController *chathistory1 = [[ChathistryViewController alloc] init]; // or initWith...
chathistory1 = [appdelegate.storyboard instantiateViewControllerWithIdentifier:@"ChathistryViewController"];//My next view controller's name
chathistory1.chatUserObject = user;
chathistory1.hidesBottomBarWhenPushed = YES;
chathistory1.self.tabBarController.navigationItem.title = user.displayName;
[self.tabBarController.navigationController pushViewController:chathistory1 animated:YES];
}
我缺少什么?还是我错了?
【问题讨论】:
-
您的
appdelegate.storyboard或chathistory1对象是nil。如果情节提要对象不为零,请确保情节提要中的场景与代码初始化中提到的标识符相同。 -
这些故事板怎么会随机变为零?
标签: ios xcode uitableview