字符串判空:
if ((value == nil) || value == (NSString *)[NSNull null] || (value.length == 0)){ ... }
字典安全取值:
#define SafeObjectForKey(dic,key) [dic objectForKey:key] == nil || [[dic objectForKey:key] isKindOfClass:[NSNull class]] ? @"" : [dic objectForKey:key]
网友评论