+ (instancetype)newWithDictionary:(NSDictionary *)dict
{
news *newOne = [self new];
[newOne setValuesForKeysWithDictionary:dict];
return newOne;
}
如果使用KVC需要字典鍵值對和模型屬性一一對應,但是重寫下面方法,就可以解決這個問題
方法內部不需要寫任何東西
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
}