简单的问题...我对我的代码有一些评论,并删除它们,并得到一个错误。几个小时后,我到达了源头。Xcode上奇怪的编译错误
此代码:
switch (indexPath.row) {
case 0:
NSLog(@"case 0");
break;
case 1: // Clients
NSLog(@"case 1");
ViewClientListTableController *viewListTableController = [[ViewClientListTableController alloc] init];//]WithNibName:@"BrowseViewController" bundle:nil];
viewListTableController.managedObjectContext = self.managedObjectContext;
[self.navigationController pushViewController:viewListTableController animated:YES];
//[self.navigationController setNavigationBarHidden:NO];
[viewListTableController release];
break;
}
这下一个,(由刚取出的NSLog(@ “情况1”);)不工作:
switch (indexPath.row) {
case 0:
NSLog(@"case 0");
break;
case 1: // Clients
ViewClientListTableController *viewListTableController = [[ViewClientListTableController alloc] init];//]WithNibName:@"BrowseViewController" bundle:nil];
viewListTableController.managedObjectContext = self.managedObjectContext;
[self.navigationController pushViewController:viewListTableController animated:YES];
//[self.navigationController setNavigationBarHidden:NO];
[viewListTableController release];
break;
}
正如你所看到的,只有NSLog线路消失了。和编译器是给我2个错误:
RootViewController.m:212:错误:213::错误: '之前ViewClientListTableController'
RootViewController.m预期表达 'viewListTableController' 未申报(第一在此函数使用)
当然,一个答案是离开NSLog线,但真的......为什么会发生这种错误?
这工作。谢谢 – elcool 2010-09-30 06:21:17
太棒了!如果这是您想要接受的答案,请不要忘记点击复选标记。 – 2010-09-30 06:28:40