Note that there are some explanatory texts on larger screens.

plurals
  1. POiphone addressbook - getting null item in ABAddressBookGetPersonWithRecordID
    primarykey
    data
    text
    <p>I'm really struggling with ABAddressBookGetPersonWithRecordID at the moment. I am saving an ID, and then trying to call it back up again. Currently im doing something simple to test the linking, but its not working.</p> <p>First, I can read objects from my iphone simulator address book using: </p> <pre><code>-(BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { NSString *contactName; NSString *contactCompany; NSString *contactFirst; NSString *contactLast; contactFirst = [(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty) stringByAppendingString:@" "]; contactLast = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); contactName = [contactFirst stringByAppendingString:contactLast]; contactCompany = (NSString *)ABRecordCopyValue(person, kABPersonOrganizationProperty); NSNumber *recordId = [NSNumber numberWithInteger: ABRecordGetRecordID(person)]; NSLog(@"record id is %d", recordId); NSLog(@"Person Reference: %d", person); NSLog(@"Name: %@", contactName); NSLog(@"Company: %@", contactCompany); </code></pre> <p>Which has the NSLog:</p> <pre><code>2010-01-26 11:52:31.396 SQL[19786:207] record id is 69283952 2010-01-26 11:52:31.397 SQL[19786:207] Person Reference: 69495792 2010-01-26 11:52:31.398 SQL[19786:207] Name: John Adams 2010-01-26 11:52:31.398 SQL[19786:207] Company: (null) </code></pre> <p>So my presumption is that it all works on that end. The problem is using the 'record id' 69283952, to call this contact info back up. I am currently trying to do it like this:</p> <pre><code>-(UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)newindexPath { ABAddressBookRef ab = ABAddressBookCreate(); ABPersonViewController *pvc = [[ABPersonViewController alloc] init]; ABRecordRef person = ABAddressBookGetPersonWithRecordID(ab,69283952); NSLog(@"person - %d", person); pvc.displayedPerson = person; NSLog(@"pvc.displayedPerson - %d", pvc.displayedPerson); pvc.addressBook = ab; pvc.allowsEditing = YES; pvc.personViewDelegate = self; [[self navigationController] pushViewController:pvc animated:YES]; [pvc release]; </code></pre> <p>Which has the NSLog</p> <pre><code>2010-01-26 11:58:19.393 SQL[19849:207] Looking Up Contact Now 2010-01-26 11:58:19.399 SQL[19849:207] person - 0 2010-01-26 11:58:19.400 SQL[19849:207] pvc.displayedPerson - 0 </code></pre> <p>And thus all i get is a null person. What am I doing wrong? I have absolutely no idea!</p> <p>regards, @norskben</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload