0

I'm trying to add a contact to custom created Group but contact every time is being added to the default contact list.

this is how I'm showing the controller

    -(void) showNewPersonContact
    {
ABRecordRef groupId=
    ABAddressBookGetGroupWithRecordID(ABAddressBookCreate(), recordId);
    ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
        picker.newPersonViewDelegate = self;
    picker.parentGroup=groupId;
        UINavigationController *navigation = [[UINavigationController alloc]      initWithRootViewController:picker];
        [self presentModalViewController:navigation animated:YES];
    }

recordId field I'm getting from another method which returns correct recordId.How is possible to create a contact in custom group by using ABNewPersonViewController?

taffarel
  • 4,015
  • 4
  • 33
  • 61

1 Answers1

0

solved!

ABRecordRef groupId=
    ABAddressBookGetGroupWithRecordID(ABAddressBookCreate(), recordId);

instead of ABAddressBookCreate() should be picker.addressBook

taffarel
  • 4,015
  • 4
  • 33
  • 61