These lines of code are the problem:
case CostPeriodMonthly:
            NSRange days = [gregorian rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit forDate:[NSDate date]];
            [endDateComponents setDay:days.length];
            [endDateComponents setMonth:[todayComponents month]];
            [endDateComponents setYear:[todayComponents year]];
            break;
The first line using days is highlighted saying "Use of undeclared identifier days" but why? What do I miss here?
 
    