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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:46:40+00:00 2026-05-11T18:46:40+00:00

The following code creates me an array of all my contacts in my address

  • 0

The following code creates me an array of all my contacts in my address book by first name and last name. The problem is, I have one contact that keeps showing up with an empty first name and last name. I can’t find that contact in my actual address book. Can anyone suggest how to debug this to figure out the source of the mystery ghost contact?

ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *peopleArray = (NSMutableArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
NSMutableArray *allNames = [NSMutableArray array];

for (id person in peopleArray) {
    NSMutableString *firstName = [(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty) autorelease];
    NSMutableString *lastName = [(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty) autorelease];
    ABMutableMultiValueRef multiValueEmail = ABRecordCopyValue(person, kABPersonEmailProperty);
    if (ABMultiValueGetCount(multiValueEmail) > 0) {
        NSString *email = [(NSString *)ABMultiValueCopyValueAtIndex(multiValueEmail, 0) autorelease];
    }

    if (![firstName length]) {
     firstName = @"";
    }
    if (![lastName length]) lastName = @"";

    [allNames addObject:[NSString stringWithFormat:@"%@ %@", firstName, lastName]];
}

The person type is of type NSCFType. I could easily do something like:

    if (![lastName length] && ![firstName length]) continue;

.. and be done with the problem. I’m curious though what entry in my AddressBook is coming up as a ghost. I’ve tried introspecting the object with gdb, but can’t get anything valuable out of it.

I’d like to see all properties for person, but derefing the object to (ABPerson*) doesn’t appear to do it.

I’ve also tried using CFShow(person) that reveals it to be type CPRecord. Can’t find further documentation on that, however.

Is there something in gdb I can do to further inspect this particular person object to see where the source of it is coming from?

  • 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-11T18:46:40+00:00Added an answer on May 11, 2026 at 6:46 pm

    The entry is probably flagged as an organization record, rather than a person record. In this case you’ll have to pull out the organization name rather than the first and last name.

    Try looking at the properties for:

    kABPersonOrganizationProperty, kABPersonKindProperty
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I have the following code: $context = stream_context_create(array( 'http' => array( 'timeout' =>
I have the following code that creates two objects (ProfileManager and EmployerManager) where the
I have the following code that creates a serverside object of the xmlhttp class.
I have the following code which creates an ImageButton and plays a sound when
I have the following code that creates the meta-description. I'm getting a 0 as
I have the following code which creates a new table. var html = '<table>';
I have a C code that creates an array of char pointers as the
I have the following code which connects to a oracle database via soap, creates
I have created an array of doubles using the following code: double *points =
I have the following code that creates a list of dates between a range.

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.