【发布时间】:2018-07-06 19:19:37
【问题描述】:
我正在使用 ObjectMapper 将 json 转换为对象,但每次都将日期设置为 1970-01-01。我看不出我的问题是什么,因为我虽然 DateTransform 能够处理格式。
这是课程:
import Foundation
import ObjectMapper
class example :Mappable
{
var ExampleDate: Date?
required init?(map: Map){
}
//Mappable
func mapping(map: Map){
ExampleDate <- (map["ReviewDate"], DateTransform())
}
}
这是其中一个日期的外观:
ExampleDate = "2018-07-05T12:41:52.087+00:00"
谢谢!
【问题讨论】:
标签: ios json swift alamofire objectmapper