尝试将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)
}
&#34;所需的初始化程序必须由CustomJsonResponse的子类提供&#34;
我在这里做错了什么?对此的任何指示都会很棒。谢谢!
答案 0 :(得分:0)
我想你错过了:
init() {
super.init()
}