خرید بک لینک

Vote count: 0

Right now its giving me this. It only happens when we go into the future towards the end of the month:

2016-04-29 17:40:13.926 ASAP[17658:927300] SECTION_ARRAY:(
        {
        "TYPE_OF_SECTION" = COMPLETED;
    },
        {
        DAY = Friday;
        "DAY_END" = 1461988799;
        "DAY_START" = 1461902400;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Saturday;
        "DAY_END" = 1462075199;
        "DAY_START" = 1461988800;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Friday;
        "DAY_END" = 1459569599;
        "DAY_START" = 1459483200;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Saturday;
        "DAY_END" = 1459655999;
        "DAY_START" = 1459569600;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Sunday;
        "DAY_END" = 1459742399;
        "DAY_START" = 1459656000;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Monday;
        "DAY_END" = 1459828799;
        "DAY_START" = 1459742400;
        "TYPE_OF_SECTION" = DAY;
    },
        {
        DAY = Tuesday;
        "DAY_END" = 1459915199;
        "DAY_START" = 1459828800;
        "TYPE_OF_SECTION" = DAY;
    }
)

CODE:

- (NSMutableArray *)nextSevenDays {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"EEEE"];
    NSMutableArray *weekDays = [[NSMutableArray alloc] init];

    NSMutableDictionary *completedTasks=[[NSMutableDictionary alloc] init];

    [completedTasks setObject:@"COMPLETED" forKey:@"TYPE_OF_SECTION"];

    [weekDays addObject:completedTasks];
    for (int i = 0; i <7; i++) {

        NSDate *date = [self dateInFuture:i];


        NSMutableDictionary *specificDayDict=[[NSMutableDictionary alloc]init];

        NSString *weekDay = [formatter stringFromDate:date];

        int startOfDay=[self convertNSDateToTimestamp:[self begiingOfDay:date]];
        int endOfDay=[self convertNSDateToTimestamp:[self endOfDay:date]];

        [specificDayDict setObject:@"DAY" forKey:@"TYPE_OF_SECTION"];

        [specificDayDict setValue:weekDay forKey:@"DAY"];
        [specificDayDict setValue:[NSNumber numberWithInt:startOfDay] forKey:@"DAY_START"];
        [specificDayDict setValue:[NSNumber numberWithInt:endOfDay] forKey:@"DAY_END"];
        [weekDays addObject:specificDayDict];

    }
    retu weekDays;
}


- (NSDate *)dateInFuture:(int)numOfDaysToAdd {


    NSDate *now=[NSDate date];
    NSCalendar *cal = [NSCalendar currentCalendar];

    NSDateComponents *plusOneDay = [[NSDateComponents alloc] init];
    [plusOneDay setDay:+numOfDaysToAdd];
    NSDate *newDate = [cal dateByAddingComponents:plusOneDay
                                           toDate:now
                                          options:NSCalendarWrapComponents];
    retu newDate;
}



- (NSMutableArray *)nextSevenDays {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"EEEE"];
    NSMutableArray *weekDays = [[NSMutableArray alloc] init];

    NSMutableDictionary *completedTasks=[[NSMutableDictionary alloc] init];

    [completedTasks setObject:@"COMPLETED" forKey:@"TYPE_OF_SECTION"];

    [weekDays addObject:completedTasks];
    for (int i = 0; i <7; i++) {

        NSDate *date = [self dateInFuture:i];


        NSMutableDictionary *specificDayDict=[[NSMutableDictionary alloc]init];

        NSString *weekDay = [formatter stringFromDate:date];

        int startOfDay=[self convertNSDateToTimestamp:[self begiingOfDay:date]];
        int endOfDay=[self convertNSDateToTimestamp:[self endOfDay:date]];

        [specificDayDict setObject:@"DAY" forKey:@"TYPE_OF_SECTION"];

        [specificDayDict setValue:weekDay forKey:@"DAY"];
        [specificDayDict setValue:[NSNumber numberWithInt:startOfDay] forKey:@"DAY_START"];
        [specificDayDict setValue:[NSNumber numberWithInt:endOfDay] forKey:@"DAY_END"];
        [weekDays addObject:specificDayDict];

    }
    retu weekDays;
}
- (NSDate *)dateInFuture:(int)numOfDaysToAdd {


    NSDate *now=[NSDate date];
    NSCalendar *cal = [NSCalendar currentCalendar];

    NSDateComponents *plusOneDay = [[NSDateComponents alloc] init];
    [plusOneDay setDay:+numOfDaysToAdd];
    NSDate *newDate = [cal dateByAddingComponents:plusOneDay
                                           toDate:now
                                          options:NSCalendarWrapComponents];
    retu newDate;
}

asked 43 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 11 ارديبهشت 1395 ساعت: 6:01

صفحه بندی