内部编译器错误:总线错误 [英] Internal compiler error: Bus error

查看:183
本文介绍了内部编译器错误:总线错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使一个UITableView与视图与详细信息,但我得到两个错误。
下面的代码后,我得到两次相同的错误:
'内部编译器错误:总线错误'
,我不知道为什么?有人可以帮助我吗?
您可以在此处找到代码的图片。

Im trying to make a UITableView with a View with Details but I get two errors. After the following code I got two times the same errors: 'Internal compiler error: Bus error' and I have no idea why? Can someone help me? You can find a image of the code under here.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSInteger row = [indexPath row];
if (self.verwaltungDetailViewController == nil){
    verwaltungDetailViewController *aVerwaltungDetail = [[verwaltungDetailViewController alloc] initWithNibName:@"VerwaltungDetailView" bundle:nil];
    self.verwaltungDetailViewController = aVerwaltungDetail;
    [aVerwaltungDetail release];

}
verwaltungDetailViewController.title =  [NSString stringWithFormat:@"%@", [verwaltungsArray objectAtIndex:row]];



NatersAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.VerwaltungNavController pushViewController:verwaltungDetailViewController animated:YES];

}

为您的帮助!

推荐答案

看起来像我有一个 code> VerwaltungDetailViewController (注意大写的V),你将它与一个实例变量& verwaltungDetailViewController (请注意小写的v)。在 if 块的第一行,当您尝试创建前者的实例时,您正在尝试创建后者的实例。您的代码应该看起来像这样:

It looks to me like you've got a class somewhere called VerwaltungDetailViewController (note the uppercase 'V') and you are mixing it up with an instance variable & property called verwaltungDetailViewController (note the lowercase 'v'). In the first line of the if block, you are attempting to create an instance of the latter, when you should be attempting to create an instance of the former. Your code should look something like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSInteger row = [indexPath row];
if (self.verwaltungDetailViewController == nil){
    VerwaltungDetailViewController *aVerwaltungDetail = [[verwaltungDetailViewController alloc] initWithNibName:@"VerwaltungDetailView" bundle:nil];
    self.verwaltungDetailViewController = aVerwaltungDetail;
    [aVerwaltungDetail release];

}
verwaltungDetailViewController.title =  [NSString stringWithFormat:@"%@", [verwaltungsArray objectAtIndex:row]];



NatersAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.verwaltungNavController pushViewController:verwaltungDetailViewController animated:YES];

编辑:您也在最后一行代码中犯了错误,除非相反。

You also make the mistake in the last line of code, except in reverse.

这篇关于内部编译器错误:总线错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆