Formally deprecated in OS X 10.10 and iOS 8:
NSYearCalendarUnit
& friends in favor ofNSCalendarUnitYear
etc.- dto for
NSGregorianCalendar
in favor ofNSCalendarIdentifierGregorian
.
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit |
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
2.新的方法:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDate *now = [NSDate date];;
NSDateComponents *comps = [[NSDateComponents alloc] init];
NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday |
NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
3.推荐的指导教程:
Google Drive SDK requires modification to run under Xcode 6 beta, primarily because of the following changes...
NSGregorianCalendarIdentifier
is deprecated in iOS 8 in favour of NSCalendarIdentifierGregorian
,
and
NSUndefinedDateComponent
is deprecated in iOS 8 in favour of NSDateComponentUndefined
,
and
all references to NSCalendarUnits
have changed so that the unique identifier of each key is moved from the front to the end. For example...
NSMonthCalendarUnit
is deprecated in iOS 8 in favour of NSCalendarUnitMonth
.
While I applaud these sensible changes, I had to run through a couple of classes to change the deprecated keys. This in itself is a five minute fix, and does not concern me at all.
My problem: When I return to Xcode 5.1.1 to continue building "next releases", I must change these back to the deprecated keys.