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

  • Home
  • SEARCH
  • 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 8165401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:31:41+00:00 2026-06-06T19:31:41+00:00

I am trying to sort the NSMutablArray values by Aa-Zz format in iPhone app.

  • 0

I am trying to sort the NSMutablArray values by Aa-Zz format in iPhone app. I have used the below code in my project.

for (id key in [dictionary allKeys])
        {
            id value = [dictionary valueForKey:key];
            [duplicateArray addObject:value];
            [value release];
            value =nil;
            NSSortDescriptor *sortdis = [[[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES] autorelease];
            NSArray *discriptor = [NSArray arrayWithObjects:sortdis,nil];
            mutableArray = [[duplicateArray sortedArrayUsingDescriptors:discriptor]retain];
        }   
        NSLog(@"mutableArray : %@", mutableArray);
[mutableArray sortUsingSelector:@selector(caseInsensitiveCompare:)];

The app getting crash with this error log: [__NSArrayI sortUsingSelector:]: unrecognized selector sent to instance.

But, i have searched and found the reason for the crash. My mutableArray values are like this,

(
        {
        Id = 00001;
        Name = "ABCD";
    },
        {
        Id = 00002;
        Name = "BCDE";
    },
        {
        Id = 00003;
        Name = "ZXYS";
    },
        {
        Id = 00004;
        Name = "abcd";
    },
        {
        Id = 00009;
        Name = "bcde";
    },
)

I want to sort this array valuse like ABCD, abcd, BCDE, bcde, ZXYs.
Can anyone please help to solve this.

  • 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-06-06T19:31:42+00:00Added an answer on June 6, 2026 at 7:31 pm

    Gopinath. Please use this updated code in your project.

        for (id key in [dictionary allKeys])
        {
            id value = [dictionary valueForKey:key];
            [duplicateArray addObject:value];
            [value release];
            value =nil;
            NSSortDescriptor *sortdis = [[[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]autorelease];
            NSArray *discriptor = [NSArray arrayWithObjects:sortdis,nil];
            mutableArray = [[duplicateArray sortedArrayUsingDescriptors:discriptor]retain];
        }   
        NSLog(@"mutableArray : %@", mutableArray);
    

    I hope it will help you. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to sort by the state of an Organization's main address. I have
I am trying to sort pixel values of an image (example 80x20) from lowest
Trying to sort the array below by memnum in ascending order, and I'm a
I'm trying to sort the rows of one array by the values of another.
I have been working on an iPhone app, where-in i have list of users
I'm trying to sort strings according to their names lexicographically. so I have an
I am trying to sort my array while using NSPredicate.. I have read other
Just need help as I have been trying sort this out for ages now.
I am trying to sort a dict based on its key and return an
I am trying to sort query result into an array. I have following query.

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.