Check if key exists in NSDictionary is null or not
I did search on how to check if NSDictionary key exists or not and came up with the solution. But still it throws me an error saying adding null value to the key. I am not sure if my code is correct or not. If anyone has any idea about this can help me. NSDictionary *result; id myImageURL = [result objectForKey:@"url"]; if ((NSNull *)myImageURL == [NSNull null]) myImageURL = @""; id myImage = [result objectForKey:@"image"]; if ((NSNull *)myImage == [NSNull null]) myImage = @""; Check if null add nothing and if not add the value. But it still gives me an error dont know why. /****OUTPUT*****/