В моем словаре содержатся две пары ключевых значений date/text..here, дата также находится в строковом формате, теперь я извлекаю ключи и значения и передаю их другие function..in ниже образомИзвлечение ключей/значений из NSDictionary приводит к неправильным данным, а также к сбою
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.timeStyle = NSDateFormatterNoStyle;
dateFormatter.dateFormat = @"dd-MMM-yyyy";
keys = [Dictionary allKeys];
values = [m_dateNoteDict allValues];
for(int i = 0 ; i<[keys count]; i++)
{
NSString *notes = [values objectAtIndex:i];
NSDate *noteDate = [dateFormatter dateFromString:[keys objectAtIndex:i]];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents = [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit)fromDate:[self getCurrentDate]];
NSInteger year = [weekdayComponents year];
[gregorian setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
NSDateComponents *timeZoneComps=[[NSDateComponents alloc] init];
[timeZoneComps setYear:year];
[timeZoneComps setHour:00];
[timeZoneComps setMinute:00];
[timeZoneComps setSecond:01];
noteDate =[gregorian dateFromComponents:timeZoneComps];
[self saveNotes:0 :noteDate :notes];//passing the date to this function
NSLog(@"dates:%@",noteDate);
}
мой словарь содержит две даты, т.е. 1 января и третий jan..but каждый раз, когда я итерацию через петлю, только первый январе пройдена, и 3 января не прошло , Итак, друзья, пожалуйста, помогите мне понять, в чем я ошибаюсь .. и иногда его авария ..
С уважением Ranjit
Да извините, то есть опечатка ошибка – Ranjit