我有以下代码:
switch (self.status) {
case refused:
message=NSLocalizedString(@"booking refused", nil);
break;
case accepted:
message=NSLocalizedString(@"booking accepted", nil);
break;
case taxiAborted:
message=NSLocalizedString(@"booking aborted", nil);
break;
case near:
message=NSLocalizedString(@"booking aborted", nil);
break;
case completed:
message=NSLocalizedString(@"booking completed", nil);
break;
default:
break;
}
永远不会进入交换机内部的:既不是默认情况也不是正确值。在我的例子中,self.status的值为“active”,它是以下枚举的一部分:
typedef enum {
requested = 0,
refused = 1,
accepted =2,
taxiAborted=3,
near = 4,
running= 5,
completed = 6,
userAborted=7
} statuses;
我做错了什么?