开发者

iphone bring up address book contact

I am having some trouble accessing the iphone addressbook given a ABReferenceID.

The method is being called correctly (accessoryButtonTappedForRowWithIndexPath), all the #import stuff is fine (as I can save the data no problem).

I have a contact with ReferenceID = 69273024, I simply want to bring 'him up.

I am trying to do this with the following technique, but line 2 is wrong. I can't work out how to correctly integrate the number into the problem. Any tips?

ABPersonViewController *pvc = [[ABPerson开发者_运维问答ViewController alloc] init];
pvc.displayedPerson = 69273024;

[[self navigationController] pushViewController:pvc animated:YES];  

Regards, norskben.


The displayedPerson property should be set to an ABRecordRef. You can get the ABRecordRef from the ABRecordID using ABAddressBookGetPersonWithRecordID. You can get the ABAddressBookRef using ABAddressBookCreate.

UPDATE
Here is example code, but I haven't tested it:

ABPersonViewController *pvc = [[ABPersonViewController alloc] init];
pvc.displayedPerson = ABAddressBookGetPersonWithRecordID(ABAddressBookCreate(),69273024);

[[self navigationController] pushViewController:pvc animated:YES];
[pvc release];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜