标签:
//该方法是检查字典中是否有nil 的,有nil就转行成""
- (NSDictionary *)checkDict:(NSDictionary *)sender
{
NSMutableDictionary * dict_mutable = [[NSMutableDictionary alloc] init];
NSArray * keys = sender.allKeys;
for (NSString * key in keys) {
if ([[sender objectForKey:key] isKindOfClass:[NSDictionary class]]) {
NSDictionary * tempDict = [self checkDict:[sender objectForKey:key]];
[dict_mutable setObject:tempDict forKey:key];
}
else{
if ([[sender objectForKey:key] isKindOfClass:[[NSNull null] class]]) {
[dict_mutable setObject:@"" forKey:key];
}
else{
[dict_mutable setObject:[sender objectForKey:key] forKey:key];
}
}
}
return dict_mutable;
}
检查字典中是否有NULL 类型,如果有的话,转换成"",因为字典中又null ,是不能存入到NSUserDefalut 里面的.
标签:
原文地址:http://www.cnblogs.com/yinyakun/p/4335020.html