0

私はiOSアプリケーションを開発しています。ABPeoplePickerNavigationController を使用しました。ABPeoplePickerNavigationController 画面が presentModalViewController メソッドで開かれ、別の画面も presentModalViewController メソッドで開かれた場合、アプリケーションがクラッシュします。

以下はサンプルコードです。どうすれば修正できますか?

-(IBAction)showContacts:(id)sender{

//    ContactListScreen *contact = [[[ContactListScreen alloc] initWithTarget:self selector:@selector(loadSelectedPerson:)] autorelease];
//    [self presentModalViewController:contact animated:YES];

    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    // place the delegate of the picker to the controll
    picker.peoplePickerDelegate = self;


    if ([Helper isIOS7]) { //IOS_7_Fix
        picker.topViewController.navigationController.navigationBar.barTintColor = [UIColor blackColor];
        picker.topViewController.navigationController.navigationBar.translucent = NO;
    }

    // showing the picker
    [self presentModalViewController:picker animated:YES];
    // releasing
    [picker release];


}

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {

    NSString *firstName = ( NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
    NSString *lastName =  ( NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
    NSString *phone =  @"";



    [self dismissModalViewControllerAnimated:YES];

    return NO;
}

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
    // assigning control back to the main controller
    [self dismissModalViewControllerAnimated:YES];
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
    return NO; 
}
4

0 に答える 0