Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6088371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:58:37+00:00 2026-05-23T11:58:37+00:00

I have to sort this array in descening order with the key likecount. How

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:58:37+00:00Added an answer on May 23, 2026 at 11:58 am

    An NSSortDescriptor should work for you. Try something like this

    NSSortDescriptor *sortd = [[[NSSortDescriptor alloc] initWithKey:@"likecount"
                                               ascending:NO] autorelease];
    NSArray *sortDescriptors = [NSArray arrayWithObject:sortd];
    sortedArray = [sourceArray sortedArrayUsingDescriptors:sortDescriptors];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to sort my Array array with specific key likecount with descending order.
Hi I have to sort this array in desc. order on the basis of
I have read over this which sort of gives an explanation of when you'd
I have a array of NSString objects which I have to sort by descending.
I have to sort the following array objects in either ascending or descending order.
I have an array in this format: Array ( [0] => Array ( [text]
I have an array of strings that I want to sort in order of
Can someone help me i need to sort this array: $report_fields['client_id'] = $row['client_id']; $report_fields['name']
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
I have a dictionary: a = {'100':12,'6':5,'88':3,'test':34, '67':7,'1':64 } I want to sort this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.