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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:46:14+00:00 2026-06-18T11:46:14+00:00

I am working on a contact list for my iphone applications. I have made

  • 0

I am working on a contact list for my iphone applications. I have made a custom object class that contains the following attributes.

  • Firstname
  • Lastname
  • Id

Now I want to make a contact list like the iphone’s contact list. So with A-B-C-D-E-… as the tableview section headers. I was following this tutorial.
But he is just working with strings. My problem is lying inside the CellForRow. Here you can see what I have ATM.

   NSString *alphabet = [firstIndex objectAtIndex:[indexPath section]];

//---get all states beginning with the letter---
NSPredicate *predicate =
[NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet];
NSLog(@"list content is here %@",[listContent valueForKey:@"name"]);
NSArray *contacts = [[listContent valueForKey:@"name"] filteredArrayUsingPredicate:predicate];
NSLog(@"Contacts array is %@",contacts);

    Contact *contact = nil;
    contact = [contacts objectAtIndex:[indexPath row]];
    NSLog(@"contact is in de else %@",contact.name);
    NSString *text = [NSString stringWithFormat:@"%@ %@",contact.name,contact.firstName];
    cell.textLabel.text = text;


   [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];

I crashes on the first row with the following Log

2013-02-07 10:52:47.963 Offitel2[7807:907] list content is here (
    Claes,
    Geelen,
    Verheyen
)
2013-02-07 10:52:47.964 Offitel2[7807:907] Contacts array is (
    Claes
)
2013-02-07 10:52:47.964 Offitel2[7807:907] -[__NSCFString name]: unrecognized selector sent to instance 0x208e2c20
2013-02-07 10:52:47.965 Offitel2[7807:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString name]: unrecognized selector sent to instance 0x208e2c20'

Can anybody help me with this?

Kind regards

  • 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-18T11:46:15+00:00Added an answer on June 18, 2026 at 11:46 am

    Follow these steps:

    • make an index alphabet array with all starting alphabet of words you are going to populate
    • Now sort it:

      //sorting for english language
      indexAlphabetArray = (NSMutableArray *)[indexAlphabetArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
      
    • Now implement

      -(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
      {
          return indexAlphabetArray;
      }
      
    • Final suggestion, take a dictionary of all names and group name with firstletter as key in dictionary, Eg.:

      nameDictionary:{
          A:(
             Astart,
             Astop,
           )
          b:(
             bstart,
             bstop,
           )
      }
      
    • In this way indexAlphabetArray = [nameDictionary allKeys];

    Edit: Lets make it more easy for you:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return [[nameDictionary valueForKey:[indexAlphabetArray objectAtIndex:section]] count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *kCellID = @"cellID";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellID];
        }
        NSArray *nameArray = [nameDictionary valueForKey:[indexAlphabetArray objectAtIndex:indexPath.section]];
        cell.textLabel.text = [nameArray objectAtIndex:indexPath.row];
        return cell;    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a web based contact list for a friend. I have
I have an application that works some what similar to how iPhone's Contact application
I have referred this code to display contact list. and it is working fine
I have make on demo that list all contact from contact Uri in that
I'm currently working in an app that shows a contact list to the user.
I am working on a simple contact form written in php and have almost
I am working on an app that reads the contact names from the mobile
I am working on a contact list project and the last thing i need
I am working on a contact list application I need to create 2 tables
I need a help in working with SearchBar in Xcode Iphone. I have a

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.