I have a NULL object returned from a JSON query string and I don't know how to check for it in an If statement. My syntax is below but I still don't seem to be able to trap for the NULL class (i.e., if nothing is returned then no text variable can be set therefore it MUST be a NULL class?), anyway, I need to check that the @"BillingStreet" has something in it and if not to avoid processing it (else the app crashes as it tries to set nothing to the text value of one of the fields in the VC):
- (void) tableView: (UITableView *)itemTableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath{
NSDictionary *obj = [self.dataCustomerDetailRows objectAtIndex:indexPath.row];
NSString *text = [obj objectForKey:@"BillingStreet"] == nil ? @"0" : [obj objectForKey:@"BillingStreet"];
NSLog(@"%@",text);
if (text.class == NULL){
} else {
NSLog(@"no street");
self.labelCustomerAddress.text = [obj objectForKey:@"BillingStreet"];
}
}