i have several dictionaries in my program,i have put all those dictionaries in an array i want to sort those dates accordingly dictionary should exchange its position,below shown is the code i am using,but i am not getting it sorted.Please help me to fix this issue
**NSLog(@"before sorting---%d",[allDataArray count]);
for(int i=0;i<[allDataArray count]-1;i++){
NSString *dateStr1=[[allDataArray objectAtIndex:i]objectForKey:@"Date"];
for(int j=i+1;j<[allDataArray count];j++){
NSString *dateStr2=[[allDataArray objectAtIndex:j]objectForKey:@"Date"];
if(([(NSDate*)dateStr1 compare:(NSDate*)dateStr2]==NSOrderedAscending)
||([(NSDate*)dateStr1 compare:(NSDate*)dateStr2]==NSOrderedSame))
[allDataArray replaceObjectAtIndex:i withObject:[allDataArray objectAtIndex:j]];
}
}
NSLog(@"afterSorting-numbers--%@",allDataArray);**