我检查,看看是否在这个字典中的项目(这是从服务器返回的)都是NULL,这样的:检查NULL不工作
NSString *imageURL = [userDict objectForKey:@"image_url"];
NSString *userName = [userDict objectForKey:@"username"];
NSString *typeName = [userDict objectForKey:@"type"];
if (imageURL == NULL || userName == NULL || typeName == NULL || imageURL.length == 0) {
localImage = [UIImage imageNamed:@"first.png"];
[addAnnotation setTitle:@"Something"];
[addAnnotation setSubTitle:@"Wrong"];
}
然而,在一个记录(以上为一个for循环)[userDict objectForKey:@"image_url"]
返回"<null>"
但在上面的if语句中没有正确处理。为什么不是我的空检查工作?