i'm an objective-c newcomer.
im trying to compare a core data entity attribute value and having trouble with the syntax. i just want to know the best way way to write the if statement to compare values.
in this example, the someAttribute attribute is a boolean, and its default is NO.
NSString *myValue = [NSString stringWithFormat:@"%@", myObject.someAttribute];
if ([myValue isEqualToString:@"1"]) {
// do something
} else {
// do something else
}
is this the right way? i've tried other flavors, like below, but the results aren't accurate:
if (myObject.someAttribute == 1) {
if (myObject.someAttribute) {