Skip to content

Instantly share code, notes, and snippets.

// Get the full search view controller lazily, set it upt as the delegate for
// the search manager and present it to the user modally.
SearchManager * manager = nil;
SearchViewController * controller = searchViewController = [[SearchViewController alloc]initWithNibName:@"SearchView2_pad" bundle:[NSBundle mainBundle]];
// Get the search manager lazily and set up the document.
manager = self.searchManager;
manager.document = self.document;
ABAddressBookRef addressBook = ABAddressBookCreate(); // create address book record
ABRecordRef person = ABPersonCreate(); // create a person
NSString *phone = @"0123456789"; // the phone number to add
//Phone number is a list of phone number, so create a multivalue
ABMutableMultiValueRef phoneNumberMultiValue =
ABMultiValueCreateMutable(kABPersonPhoneProperty);
ABMultiValueAddValueAndLabel(phoneNumberMultiValue ,phone,kABPersonPhoneMobileLabel, NULL);