尝试将 ObjectMapper 语法转换为 Swift 3.0:
class CustomJsonResponse: Mappable {
var status: String?
var response: String?
var errorCode: CustomErrorCode?
init() {
}
required init?(map: Map) {
}
func mapping(map: Map) {
status <- map["status"]
response <- map["response"]
errorCode <- (map["error_code"], CustomErrorCodeTransform())
}
}
class CustomChallengesResponse: CustomJsonResponse {
var challenges: [CustomChallenge]?
required init?(_ map: Map) {
super.init(map: map)
}
override func mapping(map: Map) {
super.mapping(map: map)
challenges <- map["data.questions"]
}
}
我在以下位置遇到错误:
required init?(_ map: Map) {
super.init(map: map)
}
“必需的初始化程序必须由 CustomJsonResponse 的子类提供”
我在这里做错了什么?对此的任何指示都会很棒。谢谢!
最佳答案
我想你错过了:
init() {
super.init()
}
关于ios - 在 ObjectMapper 中调用 super 方法的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39672710/