ABNewPersonViewController didCompleteWithNewPerson record id changed

33 views Asked by At

I'm facing issue while adding new contact and getting record id in didCompleteWithNewPerson. The record id gets automatically changed and i'm not able to get contact detail from that record id.

Here is the code i'm using to get contact detail from record id.

ABAddressBookRef myAB = ABAddressBookCreateWithOptions(NULL, NULL);
// Get the person record from the address book
ABRecordRef person = ABAddressBookGetPersonWithRecordID(myAB,(int) passedABRef);

NSLog(@"passedABRef == %ld",(long)passedABRef);

if (person)
{
    CFStringRef cfName = ABRecordCopyValue(person, kABPersonFirstNameProperty);
    if (cfName) {
        thePerson.pFirstName = (NSString *)cfName;
        CFRelease(cfName);
    } else {
        thePerson.pFirstName = @"";
    }
}
0

There are 0 answers