I am trying to display some text in a label via the following code:
if (thisPhoto.userBio != NULL)
{
thisUserBioLabel.text = [NSString stringWithFormat:@"%@",thisPhoto.userBio];
}
else
{
thisUserBioLabel.text = @"";
}
However, I am having difficulty in removing the display if the value for thisPhoto.userBio is equal to NULL. I tried to print the value using NSLog(@"%@", thisPhoto.userBio) and I am getting the value <null>. How can I amend my code above such that I will not display the message if the value is <null>?
<null>is what happens when the value isNSNullnotnil. To do this you need to add an extra check to your first if.if (thisPhoto.userBio && ![thisPhoto.userBio isEqual:[NSNull null]])That will check for both cases.