gpt4 book ai didi

objective-c - 为什么我的 switch case 有时需要在 Objective-C 中使用大括号?

转载 作者:搜寻专家 更新时间:2023-10-30 19:52:01 24 4
gpt4 key购买 nike

<分区>

有时 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 只在极少数情况下提示我的案例?我不太清楚是什么类型的代码触发了这个错误。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com