Memory leak using ABPeoplePickerNavigationController?

I use this code to display contacts in the application.

- (IBAction) selectContact:(id)sender {

    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    picker.peoplePickerDelegate = self;

    NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonAddressProperty], nil];
    picker.displayedProperties = displayedItems;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

and there is a memory leak, according to the instruments. Even if I deselected the person as follows:

- (void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
    NSLog(@"peoplePickerNavigationControllerDidCancel");

    [self dismissModalViewControllerAnimated:YES];
}

... I have a leak:

memory leak in instruments

I found several developer posts claiming that this is a bug in the SDK and that the bug has already been filed. Can anyone confirm this? or point me in the right direction.

+3
source share
2 answers

I know that this is contrary to logic and everything that you know, but please trust me. Comment out the line that the collector frees;

//-- [picker release]; this line must be commented

Most likely a bug in the Apple SDK

+1
source

SDK iOS , . , , .

0

Source: https://habr.com/ru/post/1793786/


All Articles