iOS Xcode:抛出错误

时间:2011-08-03 04:40:41

标签: ios xcode compilation

我遇到了一个奇怪的问题

case 5:
        if(1==2) {NSLog(@"Here is a tmp stuff");}
        AuthenticationViewController *authVC = [[AuthenticationViewController alloc] initWithNibName:@"AuthenticationViewController" bundle:[NSBundle mainBundle]];
        [authVC setTitle:@"Authentication"];
            //self.authViewController = authVC;
            //[authVC release];

        [self.navigationController pushViewController:authVC animated:YES];

        break;

如果我删除无用的if语句,则无法编译。我无法理解为什么?

1 个答案:

答案 0 :(得分:0)

您在案例陈述中声明了一个变量,这在C中是非法的。

有关详细信息以及如何解决此问题,请参阅以下内容:Why can't variables be declared in a switch statement?

相关问题