setNilValueForKey:could not set nil as the value for the key distance.解决方案

重写这个方法
– (void)setNilValueForKey:(NSString *)key;

-(void)setNilValueForKey:(NSString *)key{

    if ([key isEqualToString:@"originalPrice"]) {
        _originalPrice = 0;
    }else {
        [super setNilValueForKey:key];
}
}
    原文作者:蓝_上海求职
    原文地址: https://www.jianshu.com/p/8ab94816ce32
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞