component year in objective-c always returns me 0001
i need to get the actual year, only the year bu开发者_如何学编程t when i search for the result, i get always 0001. why is it?
with the component i can get the day and the month.
no ok ok... i've solved putting a variable:
unsigned int unitFlags = NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
and assigning it to the components in the NSDatecomponents object.
精彩评论