(我正在开发一个应用程序,用于在表格中显示聊天消息,但是,当用户收到聊天视图打开的消息时,用户无法启动该聊天,因此我创建了以下代码:我必须扩展哪个课程?
- (void) newMessageReceived:(NSMutableDictionary *)message
{
General *general = [General sharedManager];
NSString *firstmessage=[message objectForKey:@"msg"];
NSString *from=[message objectForKey:@"sender"];
NSArray *listItems = [from componentsSeparatedByString:@"@"];
NSString *fromsplit=[listItems objectAtIndex:0];
general.firstmess=firstmessage;
general.firstfrom=fromsplit;
NSLog(@"Mensaje recibido: %@ de %@", [message objectForKey:@"msg"], fromsplit);
ChatViewController *cvc=[[ChatViewController alloc]initWithNibName:@"Chat" bundle:nil];
[[self navigationController]pushViewController:cvc animated:YES];
}
一切正常,直到这里的ChatViewController延伸的UITableViewController但是,当收到一个消息,我得到以下异常:。
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "Chat" nib but didn't get a UITableView.
然后,我试图改变延伸到的UIViewController类(这样做检查程序是否输入numberOfRowsInSection方法),然后我收到:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ChatViewController setTableViewStyle:]: unrecognized selector sent to instance 0x9863200'
我认为解决第一个异常会解决我的问题。任何帮助?
谢谢。
什么是 “Chat.xib” 是什么样子?它必须包含一个表格视图。 – jrturton
它有一个TableView,链接到他的Controller中的Outlet。 – Fustigador