I got data from JSON and put in to an array. I successfully set cell images with it, now I'm trying to set names.
Apparently, some names are empty, or to be exactly, contain following:
"name": null, (pasted from browser JSON viewing)
So, when compiler get to this, it throw an exception with following:
name is = <null>
[NSNull length]: unrecognized selector sent to instance 0x324586a0
I even made some safe checking, but apparently its not working:
NSString *nameString = [self.dataDict valueForKey:@"name"];
if (nameString){
nameLabel.text = nameString;
}
I don't mind if name would be null
, but app just crash. How to fix that?