views:

186

answers:

1

in my iphone app, I'm wishing to link a contact to a data-piece in an array. All the data handling is fine. My question is: what contact info parameter can be saved in a database, acting as a link to a contact. Then later I will be able to call this one value and then get the link back to the contact.

---EDIT BELOW

This is where I am up to, but I just cant get it right yet. I get the contact view sliding over, but it contains an empty contact. Can someone please help.

ABPersonViewController *pvc = [[ABPersonViewController alloc] init];

int referenceid = 69249600;


ABAddressBookRef addressBook;
addressBook = ABAddressBookCreate();
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, referenceid);
//ABAddressBookGetPersonWithRecordID()

pvc.displayedPerson = person;

[[self navigationController] pushViewController:pvc animated:YES];  
NSLog(@"customerRecID %d", pvc.displayedPerson);
+1  A: 

Yes, ABRecordID is what you want to use. Not sure what you mean by "call this as a variable". If you want to convert an ABRecordRef to an ABRecordID, use ABRecordGetRecordID().

Ben Gottlieb
Ben, thanks, but can you put this in examples of code?
norskben
I'm not sure what you're trying to do. If you want convert a record to a record ID, use the above function. To go the other way, use ABAddressBookGetPersonWithRecordID()
Ben Gottlieb
i reposted my current problem, can you see a fix?
norskben
Where are you getting referenceid from?
Ben Gottlieb
ben, i posted my full problem at http://stackoverflow.com/questions/2138923/iphone-addressbook-getting-null-item-in-abaddressbookgetpersonwithrecordid
norskben