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

判断为空报错 #17

Open
Doelove opened this issue Jun 14, 2017 · 1 comment
Open

判断为空报错 #17

Doelove opened this issue Jun 14, 2017 · 1 comment

Comments

@Doelove
Copy link

Doelove commented Jun 14, 2017

当我请求的数据中有null时就会报错,感觉好像 !=nil 这个判断不适用null。。。

@Jevinliu
Copy link

Jevinliu commented Sep 8, 2017

这个问题我也遇到了,这种问题是在Json数据值中有null的情况,转换为Dictionary时,由于Swift中不允许空值nil,所以使用对象NSNull作为代替,这种空值在转换为模型数据时是要进行判断的;我目前使用这种if !(dict[key] is NSNull)进行判断

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

2 participants