Are enums not allowed as keys for an NSMutableDictionary?
When I try to add to the dictionary via:
[self.allControllers setObject:aController forKey:myKeyType];
I get the error:
error: incompatible type for argument 2 of 'setObject:forKey:'
Typically, I use NSString as my key name which doesn't require a cast to 'id' but to make the error go away, I had do that. Is the casting the correct behavior here or are enums as keys a bad idea?
My enum is defined as:
typedef enum tagMyKeyType
{
firstItemType = 1,
secondItemType = 2
} MyKeyType;
And the dictionary is defined and properly allocated as such:
NSMutableDictionary *allControllers;
allControllers = [[NSMutableDictionary alloc] init];