KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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];
Tags (comma-separated)
Save Edits
Cancel