1

我已经使用 swift 包管理器在我的项目中添加了 CalendarKit,我也尝试过使用 cocoapods,但仍然出现以下错误:
我也添加import CalendarKit了。
1) 'Date' 类型的值没有成员 'format'

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")   

2)“日期”类型的值没有成员“小时”

 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
                        }
                    }
                }

提前致谢!

4

1 回答 1

1

看起来提供的代码是使用旧版本开发的,CalendarKit它依赖于DateToolsSwift. 现在,删除依赖项后,您提供的代码将无法编译。

为了解决您的问题,请使用旧版本的 CalendarKit(不大于0.14.0,例如0.13.14就可以了),

或者,只需将DateTools独立安装并导入到您使用该框架的文件中。

于 2021-02-15T01:32:14.893 回答