alibaba / alibaba/HandyJSON

我在5.0.0.beta1 里解析模型都是nil 无法转换请问是怎么回事

Open
#339 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.3k
Forks
677
PR merge metrics
No merged PRs in 30d

Description

`class ZYSwiftBaseModel: HandyJSON {
///code
var code: Int?
///msg
var msg: String = ""
///body
var body: T?

required init() {
}

func mapping(mapper: HelpingMapper) {

mapper <<<
code <-- ["code"]
mapper <<<
msg <-- ["msg"]
mapper <<<
body <-- ["body"]
}

func didFinishMapping() {

}
}`

` ///网络模型转换
guard let responseModel = ZYSwiftBaseModel.deserialize(from: response.responseString) else {
success?(T(), -502, "数据类型转换错误")
return
}`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the ZYSwiftBaseModel.deserialize call using response.responseString and inspect how the shown mapping handles the response. Done means identifying why the result is nil and confirming that a valid response can be converted into a non-nil model.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.