1.当后台返回的为空时 设置默认值
- (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property
{
if (property.type.typeClass == [NSString class]) {
if ([oldValue isKindOfClass:[NSNull class]]||
!oldValue) {
return @"";
}
}
return oldValue;
}
2.当后台返回和自定义的属性不一致时的转化
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
return @{
@"Face" : @"face",//Face 自定义的 face后台返回的
@"NickName" : @"nickName",
@"Mobile" : @"mobile",
@"Birthday" : @"birthday",
@"Province" : @"province",
@"City" : @"city",
@"District" : @"district",
@"Email" : @"email",
@"CustomerCode" : @"customerId",
};
}