Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BMsgLog(@"create new contact");
- ABRecordRef newPersonRef = ABPersonCreate();
- ABAddressBookAddRecord(addressBookRef, newPersonRef, &error);
- if (error) {
- BErrLog(@"Error: this should never happen");
- return nil;
- }
- ABRecordRef groupRef = ABAddressBookGetGroupWithRecordID(addressBookRef, groupID.integerValue);
- ABGroupAddMember(groupRef, newPersonRef, &error);
- if (error) {
- BErrLog(@"Error: this should never happen");
- return nil;
- }
- ABAddressBookSave(addressBookRef, &error);
- if (error) {
- BErrLog(@"Error: this should never happen");
- return nil;
- }
- ABRecordID personID = ABRecordGetRecordID(newPersonRef);
- contactID = [NSNumber numberWithInteger:personID];
- CFRelease(newPersonRef);
- personRef = ABAddressBookGetPersonWithRecordID(addressBookRef, contactID.integerValue);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement