Warning:'YearCalendarUnit' was deprecated in iOS version 8.0: Use NSCalendarUnitYear instead
代码:
components(NSCalendarUnit.YearCalendarUnit, fromDate: <#NSDate#>, toDate: <#NSDate#>, options: <#NSCalendarOptions#>)
请问一下老师这个Warning该怎么处理?
代码:
components(NSCalendarUnit.YearCalendarUnit, fromDate: <#NSDate#>, toDate: <#NSDate#>, options: <#NSCalendarOptions#>)
请问一下老师这个Warning该怎么处理?
2015-04-26
你仔细看enum NSCalendarUnit的定义,在一开始有新的定义,我觉得应该是消息提示的有错误,应该是下面我标黑体的CalendarUnitYear。你怎么看?
struct NSCalendarUnit : RawOptionSetType {
init(_ rawValue: UInt)
init(rawValue: UInt)
static var CalendarUnitEra: NSCalendarUnit { get }
static var CalendarUnitYear: NSCalendarUnit { get }
static var CalendarUnitMonth: NSCalendarUnit { get }
static var CalendarUnitDay: NSCalendarUnit { get }
static var CalendarUnitHour: NSCalendarUnit { get }
static var CalendarUnitMinute: NSCalendarUnit { get }
............................
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitEra instead")
static var EraCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitYear instead")
static var YearCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitMonth instead")
static var MonthCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitDay instead")
static var DayCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitHour instead")
static var HourCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitMinute instead")
static var MinuteCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitSecond instead")
static var SecondCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitWeekOfMonth or NSCalendarUnitWeekOfYear, depending on which you mean")
static var WeekCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitWeekday instead")
static var WeekdayCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=2.0, deprecated=8.0, message="Use NSCalendarUnitWeekdayOrdinal instead")
static var WeekdayOrdinalCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=4.0, deprecated=8.0, message="Use NSCalendarUnitQuarter instead")
static var QuarterCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=5.0, deprecated=8.0, message="Use NSCalendarUnitWeekOfMonth instead")
static var WeekOfMonthCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=5.0, deprecated=8.0, message="Use NSCalendarUnitWeekOfYear instead")
static var WeekOfYearCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=5.0, deprecated=8.0, message="Use NSCalendarUnitYearForWeekOfYear instead")
static var YearForWeekOfYearCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=4.0, deprecated=8.0, message="Use NSCalendarUnitCalendar instead")
static var CalendarCalendarUnit: NSCalendarUnit { get }
@availability(iOS, introduced=4.0, deprecated=8.0, message="Use NSCalendarUnitTimeZone instead")
static var TimeZoneCalendarUnit: NSCalendarUnit { get }
}
举报