Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON 转 Model 数据校验返回 NO 没有忽略此模型 #295

Open
qiven opened this issue Sep 11, 2018 · 2 comments
Open

JSON 转 Model 数据校验返回 NO 没有忽略此模型 #295

qiven opened this issue Sep 11, 2018 · 2 comments

Comments

@qiven
Copy link

qiven commented Sep 11, 2018

在 Model 中实现 - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic; 方法,不符合条件返回 NO,容器类属性中依然可以添加此 Model。

NSObject+YYModel.m 

911.   NSObject *newOne = [cls new];
912.   [newOne yy_modelSetWithDictionary:one];
913.   if (newOne) [objectArr addObject:newOne];

猜测是不是判断条件有误,应该根据912行数据校验方法返回值来判断是否添加模型,还请前辈指点。

@git4jwb
Copy link

git4jwb commented Sep 29, 2018

遇到同样的问题

@SarielTang
Copy link

@ibireme 好像应该改成 if ([newOne yy_modelSetWithDictionary:one]) [objectArr addObject:newOne];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants