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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:34:49+00:00 2026-05-25T01:34:49+00:00

I am going through my application killing off all the memory leaks and the

  • 0

I am going through my application killing off all the memory leaks and the analyze tool comes up with a leak using the abpeoplepickernavigationcontroller.

I understand it is something to do with a copy method? but don’t know how to go about releasing it where and at the write time.

I basically need to present the modal view, select the phonenumber then drag it back into the textfield. heres my code

-(IBAction)openAddressBook{

    ABPeoplePickerNavigationController *peoplepicker = [[ABPeoplePickerNavigationController alloc] init];

    peoplepicker.peoplePickerDelegate = self;
    [self presentModalViewController:peoplepicker animated:YES];
    [peoplepicker release];

}

- (void)peoplePickerNavigationControllerDidCancel:

(ABPeoplePickerNavigationController *)peoplePicker {

    [self dismissModalViewControllerAnimated:YES];

}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
      shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
    return YES;
}

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


    //Retrieving the phone number property of ABRecordRef

    ABMultiValueRef phoneProperty = ABRecordCopyValue(person, property);
    NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty, identifier);
    phone = [phone stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    NSArray *brokenNumber = [phone componentsSeparatedByString:@" "];
    phone = [brokenNumber componentsJoinedByString:@""];

    if(![phonenumber.text isEqualToString:@""])
        phonenumber.text = [NSString stringWithFormat:@"%@%@", phonenumber.text, @";"];
    phonenumber.text = [NSString stringWithFormat:@"%@%@", phonenumber.text, phone];

    [self dismissModalViewControllerAnimated:YES];
    return NO;

}

Thanks

  • 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-25T01:34:50+00:00Added an answer on May 25, 2026 at 1:34 am

    The problem is likely to be here:

    ABMultiValueRef phoneProperty = ABRecordCopyValue(person, property);
    NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty, identifier);
    phone = [phone stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    

    You get objects copies with ABRecordCopyValue and ABMultiValueCopyValueAtIndex and they aren’t released.

    ABMultiValueRef phoneProperty = ABRecordCopyValue(person, property);
    NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty, identifier);
    if (phoneProperty) {
        CFRelease(phoneProperty);
    }
    
    NSString *trimmedPhone = [phone stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    if (phone) {
        CFRelease(phone);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going through the pain right now of finding memory leaks in my application
I'm going through some old C#.NET code in an ASP.NET application making sure that
I'm going through some old C#.NET code in an ASP.NET application making sure that
I am going to develop an application which will process online data (comming through
While going through many resources on multithreaded programming, reference to volatile specifier usually comes
I'm going through all sorts of WPF documentation, and I'm feeling unnecessarily confused. The
Well, I was going through an application where a find a variable named as
I am going through the Django sample application and come across the URLConf. I
I've been going through some tutorials on working with sqlite databases and they all
And, how does the system install all the gems for the application without going

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.