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

The Archive Base Latest Questions

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

As per my requirement, i need to get email id’s from contacts. And i

  • 0

As per my requirement,

i need to get email id’s from contacts.

And i need to write a code for this in a separate class in a method.To get call this integrate classes into my project simply call that method.

This is what i need.

for this my code in ownServices is like this.

-(NSString *)getSelectedNumberFromContatcs {
    ABPeoplePickerNavigationController *peoplePickerController = [[ABPeoplePickerNavigationController alloc] init];

    peoplePickerController.peoplePickerDelegate = self;
    [self presentModalViewController:peoplePickerController animated:NO];
    [peoplePickerController release];

    return aNSString;
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
      shouldContinueAfterSelectingPerson:(ABRecordRef)person {
    //  NSString *name = (NSString *)ABRecordCopyValue(person, kABPersonPhoneProperty);

    return YES;
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
      shouldContinueAfterSelectingPerson:(ABRecordRef)person
                                property:(ABPropertyID)property
                              identifier:(ABMultiValueIdentifier)identifier {

    if (property == kABPersonPhoneProperty) {
        ABMultiValueRef emails = ABRecordCopyValue(person, property);
        CFStringRef phonenumberselected = ABMultiValueCopyValueAtIndex(emails, identifier);
        //  CFStringRef emailLabelSelected = ABMultiValueCopyLabelAtIndex(emails, identifier);
        //  CFStringRef emailLabelSelectedLocalized = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(emails, identifier));

        aNSString = (NSString *)phonenumberselected;

        // Return to the main view controller.
        [ self dismissModalViewControllerAnimated:YES ];
        return NO;
    }   
    return YES ;
}

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
    [ self dismissModalViewControllerAnimated:YES ];

}

i am calling this in myclassviewcontroller like this.

- (void)viewDidLoad {
    [super viewDidLoad];
    ownServices *obj = [[ownServices alloc]init];
    [obj getSelectedNumberFromContatcs];

    }

But contatcs viewcontraoller is not opened.

But i try same code in view controller in a button action like this

-(IBAction)openContacts {
    ABPeoplePickerNavigationController *peoplePickerController = [[ABPeoplePickerNavigationController alloc] init];

    peoplePickerController.peoplePickerDelegate = self;
    [self presentModalViewController:peoplePickerController animated:NO];
    [peoplePickerController release];

} 

Then contacts viewconrtroller opened.

i did n’t why view controller is not opened by calling it in a method.

is it possible to do like this.

can any one please help me.

Thank u in advance.

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

    Because the class you are using is inherited from NSObject not UIViewController so the [self presentModalViewController:peoplePickerController animated:NO]; will not work. Also
    you have written this method in a wrong way

    -(NSString *)getSelectedNumberFromContatcs {
        ABPeoplePickerNavigationController *peoplePickerController = [[ABPeoplePickerNavigationController alloc] init];
    
        peoplePickerController.peoplePickerDelegate = self;
        [self presentModalViewController:peoplePickerController animated:NO];
        [peoplePickerController release];
    
        return aNSString;
    }
    

    Let me know what actually you want to do?

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

Sidebar

Related Questions

My requirement is to call WCF web service from ASP.NET code behind and pass
As per project requirement we need to convert images from word document into bitmap
Please see the sample xml given below. As per a requirement, I need to
I'm populating a CheckBoxList from database table. As per requirement, all the values should
As per client requirement i want to send crash Report when App get crash.
Per a client's request I have written a communication class that inherits from webclient.
I need to rename file on client side as per client requirement. I understand
I have a requirement where i need to search product barcode from a csv
Need help to convert code from asp control to input type to fetch file
The question arises from the need to reuse a code for different types of

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.