Hi folks, I'm having a problem with enum type initialization that appears to be simple to solve but I haven't figured out how to do it. Suppose I declare the following enum type:
typedef enum NXSoundType {
NXSoundTypeNone,
NXSoundTypeEffect,
NXSoundTypeBackgroundMusic
} NXSoundType;
I declare a convenience method for returning one of the NXSoundType enum types given a NSString object like this (NOTE: NXSound is an object that contains a NXSoundType attribute named "type"):
- (NXSoundType)nxSoundTypeFromIdentifier:(NSString*)nxSoundIdentifier {
NXSoundType type = NXSoundTypeNone;
for (NXSound *nxSound in self.nxSounds) {
if ([nxSound.identifier isEqualToString:nxSoundIdentifier]) {
type = nxSound.type;
}
}
return type;
}
So far, so well. But the following call is not working:
NXSoundType type = [self nxSoundTypeFromIdentifier:@"kNXTargetGameSoundIdEffectTic"];
What's wrong? Thank you in advance.