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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:41:04+00:00 2026-05-20T00:41:04+00:00

I want to be able to import contact group data when I import contacts

  • 0

I want to be able to import contact group data when I import contacts in my application. Is there a method for me to get this data from iOS or am I just limited to get contact details?

  • 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-20T00:41:05+00:00Added an answer on May 20, 2026 at 12:41 am

    This is how I import contact information into my app. I store the info in an NSDictionary so I can read it back later easily. It’s in no way pretty, but works very well.

    .h

    #import <AddressBook/AddressBook.h>
    #import <AddressBookUI/AddressBookUI.h>
    
    @interface YourViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate>
    {
    }
    @end
    

    .m

    #pragma mark -
    #pragma mark AddressBook Delegates
    
    - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
        return NO;
    }
    - (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
        [self dismissModalViewControllerAnimated:YES];
    }
    - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
    
        /* photo */
        CFDataRef imgeData = ABPersonCopyImageData(person);
        if(imgeData)
        {
            /* set an image to something using: (NSData*)imgeData */
            CFRelease(imgeData);
        }else{
            /* theres no photo */
        }
    
        CFStringRef email,emailLabel, phone,phoneLabel, url,urlLabel;
        //Phone Numbers
        ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(person, kABPersonPhoneProperty);
        NSMutableDictionary *myPhoneDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(phoneMulti)];
        for (CFIndex i = 0; i < ABMultiValueGetCount(phoneMulti); i++) { 
            phoneLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(phoneMulti, i));
            phone = ABMultiValueCopyValueAtIndex(phoneMulti, i); 
            [myPhoneDict setObject:(NSString*)phone forKey:(NSString*)phoneLabel];
            //NSLog(@"%@: %@",phoneLabel,phone);
            CFRelease(phone);
            CFRelease(phoneLabel);
        } 
        if ( [myPhoneDict objectForKey:@"mobile"] != nil) {
            [plistDict setObject:[NSString stringWithFormat:@"%@",[myPhoneDict objectForKey:@"mobile"]] forKey:@"Phone"];
        } else if ( [myPhoneDict objectForKey:@"home"] != nil) {
            [plistDict setObject:[NSString stringWithFormat:@"%@",[myPhoneDict objectForKey:@"home"]] forKey:@"Phone"];
        } else if ( [myPhoneDict objectForKey:@"work"] != nil) {
            [plistDict setObject:[NSString stringWithFormat:@"%@",[myPhoneDict objectForKey:@"work"]] forKey:@"Phone"];
        }
    
        //Email Address
        ABMutableMultiValueRef emailMulti = ABRecordCopyValue(person, kABPersonEmailProperty);
        NSMutableDictionary *myEmailDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(emailMulti)];
        for (CFIndex i = 0; i < ABMultiValueGetCount(emailMulti); i++) { 
            emailLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(emailMulti, i));
            email = ABMultiValueCopyValueAtIndex(emailMulti, i); 
            [myEmailDict setObject:(NSString*)email forKey:(NSString*)emailLabel];
            CFRelease(email);
            CFRelease(emailLabel);
        } 
        if ([myEmailDict objectForKey:@"home"] != nil) {
            [plistDict setObject:[myEmailDict objectForKey:@"home"] forKey:@"EmailHome"];
        } else {
            [plistDict setObject:@"" forKey:@"Email"];
        } if ([myEmailDict objectForKey:@"work"] != nil) {
            [plistDict setObject:[myEmailDict objectForKey:@"work"] forKey:@"EmailWork"];
        } else {
            [plistDict setObject:@"" forKey:@"Email"];
        } if ([myEmailDict objectForKey:@"other"] != nil) {
            [plistDict setObject:[myEmailDict objectForKey:@"other"] forKey:@"EmailOther"];
        } else {
            [plistDict setObject:@"" forKey:@"Email"];
        }
    
        //Website Address
        ABMutableMultiValueRef URLMulti = ABRecordCopyValue(person, kABPersonURLProperty);
        NSMutableDictionary *myURLDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(URLMulti)];
        for (CFIndex i = 0; i < ABMultiValueGetCount(URLMulti); i++) { 
            urlLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(URLMulti, i));
            url = ABMultiValueCopyValueAtIndex(URLMulti, i); 
            [myURLDict setObject:(NSString*)url forKey:(NSString*)urlLabel];
            //NSLog(@"%@",myURLDict);
            CFRelease(url);
            CFRelease(urlLabel);
        } 
    
        if ([myURLDict objectForKey:@"home page"] != nil) {
            [plistDict setObject:[myURLDict objectForKey:@"home page"] forKey:@"Website"];
        }else{
            [plistDict setObject:@"" forKey:@"Website"];
        }
    
        //Full Address
        ABMultiValueRef streets = ABRecordCopyValue(person, kABPersonAddressProperty);
        //NSMutableDictionary *myAddressDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(streets)];
        for (CFIndex j = 0; j < ABMultiValueGetCount(streets); j++) {
            NSMutableDictionary *myLabelDict = [[NSMutableDictionary alloc] init];
            CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(streets, j);
            CFStringRef typeTmp = ABMultiValueCopyLabelAtIndex(streets, j);
            CFStringRef type = ABAddressBookCopyLocalizedLabel(typeTmp);
            NSString *street = [(NSString *)CFDictionaryGetValue(dict, kABPersonAddressStreetKey) copy];
            NSString *city = [(NSString *)CFDictionaryGetValue(dict, kABPersonAddressCityKey) copy];
            NSString *state = [(NSString *)CFDictionaryGetValue(dict, kABPersonAddressStateKey) copy];
            NSString *zip = [(NSString *)CFDictionaryGetValue(dict, kABPersonAddressZIPKey) copy];
            NSString *country = [(NSString *)CFDictionaryGetValue(dict, kABPersonAddressCountryKey) copy];
    
            if ((street != nil) && (street.length > 0)){
                [plistDict setObject:street forKey:@"Street"];
            }else{
                [plistDict setObject:@"" forKey:@"Street"];
            }
    
            if ((city != nil) && (city.length > 0)){
                [plistDict setObject:city forKey:@"City"];
            }else{
                [plistDict setObject:@"" forKey:@"City"];
            }
    
            if ((state != nil) && (state.length > 0)){
                [plistDict setObject:state forKey:@"State"];
            }else{
                [plistDict setObject:@"" forKey:@"State"];
            }
    
            if ((zip != nil) && (zip.length > 0)){
                [plistDict setObject:zip forKey:@"Zip"];
            }else{
                [plistDict setObject:@"" forKey:@"Zip"];
            }
    
            if ((country != nil) && (country.length > 0)){
                [plistDict setObject:country forKey:@"Country"];
            }else{
                [plistDict setObject:@"" forKey:@"Country"];
            }
    
            if (type != nil){
                [plistDict setObject:(NSString *)type forKey:@"AddressType"];
            }else{
                [plistDict setObject:@"" forKey:@"AddressType"];
            }
    
    
            [myLabelDict release];
            [street release];
            [city release];
            [state release];
            [zip release];
            [country release];
    
            CFRelease(dict);
            CFRelease(type);
        }
        CFRelease(streets);
        CFRelease(phoneMulti);
        CFRelease(emailMulti);
        CFRelease(URLMulti);
    
    
        [plistDict writeToFile:current atomically:YES];
        [self dismissModalViewControllerAnimated:YES];
    
        [self refreshViews];
        [tblAddCarrier reloadData];
        return YES;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my application to look like this. I am able to get names
I have this method that generates random questions, I want to be able to
i am able to import contacts from phone contacts to a table in my
i am able to import the contacts from phone book and displaying them in
I want to be able to import things from applications in my project without
I want to be able to do this. MyInterface interface = new ServiceProxyHelper<ProxyType>(); Here's
I want to be able to generate PDF output from my (native) C++ Windows
I want to be able to get an estimate of how much code &
I'm using SQL Server 2005, VB.NET 2005. I want to be able to import
I'm designing a Google Contacts Import application using OAuth and PHP. I'm trying to

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.