I have a JSON parser in my app, and I load the value into a detailDataSourceDict variable. When I try to get the valueForKey of the array and try to compare it to 0, it never works...
Here's my code:
if (indexPath.row == 1) {
NSNumber *rating = [detailDataSourceDict valueForKey:@"rating"];
NSLog(@"Rating: %@",rating);
if (rating == 0) {
cell.detailTextLabel.text = @"This sheet has not yet been rated.";
}
else {
cell.detailTextLabel.text = [NSString stringWithFormat:@"This sheet has a %@ star rating.",rating];
}
cell.textLabel.text = @"Rating";
}
I see in my JSON feed that "rating":"0", but when the rating is 0, it shows "This sheet has a 0 star rating.", instead of "This sheet has not yet been rated."
Any suggestions? Thanks.