I have to sort this array in descening order with the key "likecount". How can I sort it by specific key? This text is my output which coming on console:
source id key is (
{
2 = likecount;
"This wall post is not from application. Direct from website." = message;
},
{
0 = likecount;
"New integration" = message;
},
{
1 = likecount;
"This is beta testing.. yes" = message;
},
{
2 = likecount;
"hello wall testing.." = message;
}
)
I tried this below code but not getting any result. Still output is without sorted.
NSSortDescriptor *descriptor=[[NSSortDescriptor alloc]initWithKey:@"likecount" ascending:YES];
NSArray *sortdescriptor=[NSArray arrayWithObject:descriptor];
NSArray *sortedarray=[array sortedArrayUsingDescriptors:sortdescriptor];
NSLog(@"source sorting id key is %@",sortedarray);
NSLog(@"source s@@@@@@ id key is %@",array);
// array is variable which is holding actual content