AnastasiaY AnastasiaY - 4 months ago 34
Objective-C Question

IOS expected expression error

I want to use an if-statement inside the switch but I keep getting an expected expression error. I would be grateful if anyone could help me to solve this issue.

switch ([ApplicationModel getApplicationType]) {
case CSApplication: {}
break;
case RAApplication:
{
if (indexPath.row == FloorLevelIndex || indexPath.row == RoomIndex)
{
[cell setUserInteractionEnabled: YES];
}
}
break;
default:
break;
}

Answer

If FloorLevelIndex and RoomIndex are types, you won't be able to compare a number to a type (hence the error). You probably want the number representation of those or define them with a NSInteger value

Comments