天天看点

iOS lldb调试使用expr 设置枚举值

如果我们直接设置我们定义的枚举类型,会报 

error: use of undeclared identifier 'xxxx'

error: 1 errors parsing expression

如果我们直接设置整数(枚举默认就是从0开始,依次递增,除非我们自己重新赋值),会报不能直接付int类型的值

error: cannot initialize a parameter of type 'xxxx' (aka '(anonymous enum)') with an rvalue of type 'int'

error: 1 errors parsing expression

我们需要在赋的int值前面加上(定义的枚举名字),比如

expr testType=(SMCurrentType)1

SMCurrentType 是我们定义的枚举类型

这样就能正确设置了,就不会报错了

继续阅读