Developer Forums relocated!

Need help with Apple Developer tools and technologies? Want to share information with other developers and Apple engineers? Visit Developer Forums at Apple.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

ABUnknownPersonViewController will not behave like unknown, recent call

I'm trying to take a recent call/phone number and give the user the option to "Create New Contact" or "Add to Existing Contact" (just like the view controller that is presented for recent calls that are not listed in your address book).

Unfortunately, the SDK seems to force me to specify the phone number in advance as a mobile/home/work/etc. number.

If you look at Apple's implementation, they put the number in bold at the top and then when you specify Create New Contact/Add to Existing Contact, you can choose to put it as mobile/home/work/etc.

(And if you look closely, when you Add to Existing Contact they will try to first to assign it as a mobile number, then home number, then work number, etc.. down the hierarchy automatically.)

My question to you is, how can I recreate Apple's implementation of assigning a phone number?

This is what I'm having to do now..

// Create the person with a phone number of a given type (mobile)
ABRecordRef person = ABPersonCreate();
CFErrorRef *error = NULL;

ABMultiValueRef phoneNumbers = ABMultiValueCreateMutable(kABPersonPhoneProperty);
BOOL addedNumber = ABMultiValueAddValueAndLabel(phoneNumbers, @"987-654-3210", kABPersonPhoneMobileLabel, NULL);

if (addedNumber)
ABRecordSetValue(person, kABPersonPhoneProperty, phoneNumbers, error);

// Create the unknown view controller and add the person
ABUnknownPersonViewController *personViewController = [[ABUnknownPersonViewController alloc] init];
personViewController.displayedPerson = person;

personViewController.allowsAddingToAddressBook = YES;
personViewController.allowsActions = YES; // this doesn't seem to work?
personViewController.unknownPersonViewDelegate = self;

personViewController.alternateName = @"987-654-3210";
personViewController.message = @"August 17, 2008 3:20 PM";
// will eventually make this modal view controller
[self.navigationController pushViewController:personViewController animated:YES];

Mac Pro and Macbook Pro, Mac OS X (10.5.4)

Posted on Aug 26, 2008 4:21 PM

Reply

There are no replies.

ABUnknownPersonViewController will not behave like unknown, recent call

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.