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 6192705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:59:22+00:00 2026-05-24T02:59:22+00:00

Using the Graph Facebook API with this code [facebook requestWithGraphPath:@me/friends andDelegate:self]; Now I have

  • 0

Using the Graph Facebook API with this code

[facebook requestWithGraphPath:@"me/friends" andDelegate:self]; 

Now I have an NSDictionary which is like this:

{data =     (
            {
        id = 123456;
        name = "Mark Zuckerberg";
    },
            {
        id = 654321;
        name = "Steve Jobs";
    },
            {
        id = 13579;
        name = "Bill Gates";
    }
    ...
  );
}

I want to sort this NSDictionary, but I know that is not possible.
Of course, I can create 2 NSArray (or NSMutableArray), one “array_id” and the other one “array_name”.
I’d like to sort “array_name”, but keeping the reference to the id.

For example, if my two arrays are something like this:

array_name = {"Mark", "Steve", "Bill};
array_id   = {"123456", "654321", "13579"};

I want, at the end, something like this:

array_name = {"Bill", "Mark", "Steve"};
array_id   = {"13579", "123456", "654321"};

What do you suggest me? Thanks!

  • 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-24T02:59:22+00:00Added an answer on May 24, 2026 at 2:59 am

    It doesn’t look like you want to sort an NSDictionary, you want to sort an NSArray of NSDictionary objects that just so happens to itself be in an NSDictionary. You can simply extract this friends array as follows:

    NSArray *unsortedFriends = [dictionaryFromFacebook objectForKey:@"data"];
    

    Now you can do the following:

    NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES];
    NSArray *sortedFriends = [unsortedFriends sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this library for Facebook graph API access within my codeigniter project: http://www.haughin.com/code/facebook/
I have a Facebook desktop application and am using the Graph API . I
I want to fetch the Facebook user's online friends using Graph API but I
I'd like to be able to tag existing friends using the graph api: Here's
I'm using the new facebook graph API and getting an odd error when I
`I have fetched all the pages of users using manage_page permission, using this code
I have a chrome extension that uses the facebook Graph API Because its a
For users on Facebook, I gather information like their user ID by using this
I am using the Facebook Graph API to get basic info of a facebook
I am using Facebook graph API and getting its result in json format.. I

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.