问题描述
我有一些参数,需要发布repeatInfo的请求。在JSON写入(__SwiftValue)中将错误作为无效类型获取错误信息
以下是发布请求参数。
class RepeatInfo: NSObject,Codable {
dynamic var repeatType: String?
dynamic var endRecurrance : String?
dynamic var weekPattern: [String]?
enum CodingKeys: String,CodingKey {
case repeatType = "repeatType"
case endRecurrance = "endRecurrance"
case weekPattern = "weekPattern"
}
convenience init(repeatType : String?,endRecurrance : String?,weekPattern :
[String]?) {
self.init()
self.repeatType = repeatType
self.endRecurrance = endRecurrance
self.weekPattern = weekPattern
}
convenience required init(from decoder : Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let repeatType = try container.decode(String.self,forKey: .repeatType)
let endRecurrance = try container.decode(String.self,forKey: .endRecurrance)
let weekPattern = try container.decode([String].self,forKey: .weekPattern )
self.init(repeatType: repeatType,endRecurrance: endRecurrance,weekPattern: weekPattern )
}
}
下面是repeatInfo的类。
{{1}}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)