Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 我必须延长哪个班?_Iphone_Ios_Uitableview - Fatal编程技术网

Iphone 我必须延长哪个班?

Iphone 我必须延长哪个班?,iphone,ios,uitableview,Iphone,Ios,Uitableview,(我正在开发一个在表格中显示聊天信息的应用程序。但是,当用户收到信息时,聊天视图将打开,用户无法启动此聊天。因此,我编写了以下代码: - (void) newMessageReceived:(NSMutableDictionary *)message { General *general = [General sharedManager]; NSString *firstmessage=[message objectForKey:@"msg"]; NSString *from=

(我正在开发一个在表格中显示聊天信息的应用程序。但是,当用户收到信息时,聊天视图将打开,用户无法启动此聊天。因此,我编写了以下代码:

- (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'
我想解决第一个异常会解决我的问题。有什么帮助吗


谢谢。

解决了这个问题。我单击.xib文件,在“对象”下,单击“视图”。然后,在自定义类的Identity Inspector(第三个,从左开始)中,将其设置为UITableView。之前它只是“视图”。然后,一切正常

In the second exception i think you have called [self setTableViewStyle:] method, while   

you have made it UIViewController.

So try to call this method by tableViewOutlet.

[tableView setTableViewStyle:];

希望这将帮助您

Chat.xib”是什么样子的?它必须包含一个表视图。它有一个表视图,链接到他的控制器中的一个插座。阿披实,我在代码中没有调用该方法,是调用它的框架。但是,无论如何,我解决了它,正如您可以在下面阅读的那样。谢谢!)