Suppose I have an enum as follows:
typedef enum {
FooGoods = 0,
FooInsurance = 1,
} FooCategory;
And I have it as property and ivar in another object
@property (nonatomic) FooCategory *category;
When I create that other object, I am filling with values from an NSDictionary So I do something like this:
[baz setCategory:[aDictionary objectForKey:@"Category"]];
However because my enum is not a pointer, I get an error.
Doing this get a warning as well, “Incompatible integer to pointer conversion”:
[baz setCategory:[[aDictionary objectForKey:@"Category"] intValue]];
Any other way that is error/warning free?
The following is not correct
should be changed to
Now this should work without warnings