【发布时间】:2013-07-09 01:21:59
【问题描述】:
有时 Xcode 会在 case 之后的一行显示错误“Expected expression”。例如,Xcode 用红色箭头指向 UserContentViewController:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row) {
case IndexVideo:
UserContentViewController* detailViewController = [[UserContentViewController alloc] initWithUser:self.user];
[self.navigationController pushViewController:detailViewController animated:YES];
break;
}
}
如果我在箱子周围加上大括号,错误就消失了。首先,我想知道不使用大括号有什么问题。我从来没有在任何其他语言的情况下使用大括号。其次,为什么 Xcode 只在极少数情况下抱怨我的案例?我不太清楚是什么类型的代码触发了这个错误。
【问题讨论】:
标签: objective-c