Here the code I solved this topic. I stored in the NSUserdefaults the days that count as overdue. An did here the check
- (NSNumber *)invoiceOverDue
{
NSNumber *result;
NSInteger dueDays = [[NSUserDefaults standardUserDefaults] integerForKey:VPPayDue];
if ([[self dueTime] intValue] > dueDays)
{
result = [NSNumber numberWithBool:YES];
}
else {
result = [NSNumber numberWithBool:NO];
}
return result;
}
And here the part in witch I calculate the overdue time.
// DueTime calculation
-(NSNumber *)dueTime
{
// NSTimeInterval secondsPerDay = 24 * 60 * 60;
if ([[self invoiceStatus] intValue] > 1)
{
return [NSNumber numberWithInt:0];
}
else {
NSTimeInterval calculateTime = [[* Insert here the date of your invoice*] timeIntervalSinceNow];
//DLog(@"dueTime bevor / 86400 :%f", calculateTime);
calculateTime /= -86400;
//DLog(@"dueTime :%f", calculateTime);
int returnInt = [ConverterHelper numberRoundUp:calculateTime];
return [NSNumber numberWithInt:returnInt];
}
}