奇怪:
switch(type) {
case NSFetchedResultsChangeInsert:
int x = 5; // error: "Expected expression before int"
break;
}
因此无法在switch-case-block中创建局部变量?
答案 0 :(得分:12)
您尝试添加花括号吗?
switch(type) {
case NSFetchedResultsChangeInsert:
{
int x = 5; // error: "Expected expression before int"
break;
}
}