Hey guys,
I have a settings.bundle that has a Multi Value Specifier that is working properly, I get the setting's value and all but when checking for the string's value it messes up.
For example, if I load the setting's value and display it in an Alert View, it shows the correct value. However, if I check for the setting's value in an if statement, it doesn't work. Here's some example code
Code:
NSString *selectedCarType = [[NSUserDefaults standardUserDefaults] stringForKey:@"default_car"];
/* This displays the correct value and everything ! */
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Setting Value"
message: selectedCarType
delegate:self cancelButtonTitle:@"Ok, Close"
otherButtonTitles:nil];
[alert show];
[alert release];
/* This doesn't work for some reason */
if(selectedCarType == @"All") {
[listofCars addObject:sportcarDictionary];
[listofCars addObject:suvcarDictionary];
[listofCars addObject:vancarDictionary];
} else if(selectedCarType == @"Sport") {
[listofCars addObject:sportcarDictionary];
}
If I set the selectedCarType to "All" without checking for the settings value, the if statement works. Any help would be nice, thanks!