Ios 类型为'的值;日期';没有成员';格式'&;类型为'的值;日期';没有成员';小时数';
我已经使用swift package Manager在我的项目中添加了CalendarKit,我也尝试了cocoapods,但仍然出现以下错误:Ios 类型为'的值;日期';没有成员';格式'&;类型为'的值;日期';没有成员';小时数';,ios,swift,calendarkit,xcode12.3,Ios,Swift,Calendarkit,Xcode12.3,我已经使用swift package Manager在我的项目中添加了CalendarKit,我也尝试了cocoapods,但仍然出现以下错误: 我还添加了导入日历套件。 1)类型为“日期”的值没有成员“格式” let timezone = TimeZone.ReferenceType.default var info:[String] = ["Booking Id: \(bookingDetails.bookingID ?? -1)", "Book
我还添加了导入日历套件。
1)类型为“日期”的值没有成员“格式”
let timezone = TimeZone.ReferenceType.default
var info:[String] = ["Booking Id: \(bookingDetails.bookingID ?? -1)", "Booking Type: \(bookingDetails.bookingType!)"]
info.append("Booking From : \(begining.format(with: "dd.MM.YYYY", timeZone: timezone)) \nBooking To : \(ending.format(with: "dd.MM.YYYY", timeZone: timezone))")
info.append("Timing: \(begining.format(with: "HH:mm")) - \(ending.format(with: "HH:mm"))")
info.append("Status: \(status)\n")
if indexPath.section == 1 {
selectedbookingRecord = self.upcomingBookings![indexPath.row] as BookingInfoList
if let bookingStartDateTime = selectedbookingRecord?.bookingFrom {
if (bookingStartDateTime.toDate()?.hours(from: Date()))! < 24 {
DispatchQueue.main.async {
Alert().showAlert(ALERT_TITLE, message: GlobalConstants.CANNOT_DELETE_BOOKING, okButtonTitle: ALERT_OK_TITLE, CompletionHandler: nil, View: self)
}
return
}
}
}
2)类型“日期”的值没有成员“小时”
let timezone = TimeZone.ReferenceType.default
var info:[String] = ["Booking Id: \(bookingDetails.bookingID ?? -1)", "Booking Type: \(bookingDetails.bookingType!)"]
info.append("Booking From : \(begining.format(with: "dd.MM.YYYY", timeZone: timezone)) \nBooking To : \(ending.format(with: "dd.MM.YYYY", timeZone: timezone))")
info.append("Timing: \(begining.format(with: "HH:mm")) - \(ending.format(with: "HH:mm"))")
info.append("Status: \(status)\n")
if indexPath.section == 1 {
selectedbookingRecord = self.upcomingBookings![indexPath.row] as BookingInfoList
if let bookingStartDateTime = selectedbookingRecord?.bookingFrom {
if (bookingStartDateTime.toDate()?.hours(from: Date()))! < 24 {
DispatchQueue.main.async {
Alert().showAlert(ALERT_TITLE, message: GlobalConstants.CANNOT_DELETE_BOOKING, okButtonTitle: ALERT_OK_TITLE, CompletionHandler: nil, View: self)
}
return
}
}
}
如果indexath.section==1{
selectedbookingRecord=self.upcomingBookings![indexath.row]作为BookingFolderList
如果让bookingStartDateTime=selectedbookingRecord?.bookingFrom{
如果(bookingStartDateTime.toDate()?.hours(from:Date())!<24{
DispatchQueue.main.async{
Alert().showAlert(Alert\u标题,消息:GlobalConstants.CANNOT\u DELETE\u BOOKING,OK按钮:Alert\u OK\u标题,CompletionHandler:nil,View:self)
}
返回
}
}
}
提前谢谢 提供的代码似乎是使用旧版本的
CalendarKit
开发的,该版本依赖于DateToolsSwift
。现在,当依赖项被删除时,您提供的代码不会编译
为了解决您的问题,可以使用旧版本的CalendarKit(不大于0.14.0
,例如0.13.14
就可以了)
或者,只需独立安装并导入到使用该框架的文件中。除了您的问题之外,
yyy
是错误的。好的,那么我应该使用什么来代替yyy?好的。经过一些挖掘。它以前依赖于DateSwiftTools,DateSwiftTools具有func格式(使用dateFormat:String)->String
(与Date+Comparators.swift中的hours(from:)相同)
。自述文件根本不是最新的。我做了一些挖掘,找到了它们的实现位置。但是它们只在自述文件中,所以我认为这只是一个过时的自述文件,不应该影响真正的代码。如果您仍然需要这些方法,我指出另一个GitHub需要DateSwiftTools
。它已被删除。请使用与Hello@richard之前对应的版本。我在尝试此版本时遇到以下错误:[!]无法找到CalendarKit~>0.13.14
的规范您有:*过期的源repo,您可以使用pod repo update
或pod install--repo update
进行更新*键入的名称或版本错误。*未将承载Podspec的源repo添加到您的Podfile中。Install DateTools适用于我,谢谢!安装DateTools是一种更好的方法,因为您将获得CalendarKit的所有最新更新。如果项目仅处于维护阶段,我还建议“修复”用于0.14.x
的库版本。