MJExtension归档解档奔溃 ,YYMode 归档解档正常的对比
由于作者懒得截图,只说明是在[NNObjcect encoderObject: forKey:] 处crash。
第一种解决办法就是
// 解档时可能会因为@“hash”而是crash失败
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
NSLog(@"%s--%@-%@",__func__,key,value);
}
// 归档时使用,防止crash
+ (NSArray *)mj_ignoredCodingPropertyNames{
return @[@"superclass",@"debugDescription",@"hash",@"description"];
}
第二中方就是使用YYModel
来进行,归档解档。
总结:不要过分相信第三方框,项目越大bug也多。
网友评论