这段 Swift 3 代码一直工作到 XCode 8 beta 3:
let calendar = Calendar.current
let anchorComponents = calendar.components([Calendar.Unit.day, Calendar.Unit.month, Calendar.Unit.year, Calendar.Unit.hour], from: self)
在 Xcode 8 beta 4Calendar.Unit
中似乎被重命名为Calendar.Component
.
现在这段代码
let calendar = Calendar.current
let anchorComponents = calendar.components([Calendar.Component.day, Calendar.Component.month, Calendar.Component.year, Calendar.Component.hour], from: self)
产生编译器错误cannot convert value of type Calendar.Component to NSCalendar.Unit
我做错了什么还是这是一个错误?