我跑的时候有例外。
Could not cast value of type '__NSDate' (0x1051bd6a0) to 'NSString' (0x10564d8e0).
例外:
var datePicker = ActionSheetDatePicker(title: "Date:",datePickerMode: UIDatePickerMode.Date, selectedDate: NSDate(),doneBlock: {
picker, value, index in
self.year = value as! NSString
println("year = \(year)")
println("value = \(value)")
return
}, cancelBlock: { ActionStringCancelBlock in return }, origin: sender.superview!.superview)
我错过了什么?
((HttpServletRequest) request).getHeader("SOAPAction");
答案 0 :(得分:3)
我认为您必须通过所选值将日期转换为字符串
let formatter: DateFormatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd-HH-mm-ss"
let dateStr: String = formatter.string(from: value as! Date)
您可以使用任何其他格式,例如:“yyyy”或“HH:mm:ss”等。
并将其设置为年变量
self.year = dateStr