我通過下面的代碼。
ABRecordRef person = ABPersonCreate();
CFErrorRef error = NULL;
// firstname
ABRecordSetValue(person, kABPersonFirstNameProperty, @"Don Juan", NULL);
// email
ABMutableMultiValueRef email = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(email, @"[email protected]", CFSTR("email"), NULL);
ABRecordSetValue(person, kABPersonEmailProperty, email, &error);
CFRelease(email);
// Start of Address
ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);
NSMutableDictionary *addressDict = [[NSMutableDictionary alloc] init];
[addressDict setObject:@"The awesome road numba 1" forKey:(NSString *)kABPersonAddressStreetKey];
[addressDict setObject:@"0568" forKey:(NSString *)kABPersonAddressZIPKey];
[addressDict setObject:@"Oslo" forKey:(NSString *)kABPersonAddressCityKey];
ABMultiValueAddValueAndLabel(address, addressDict, kABWorkLabel, NULL);
ABRecordSetValue(person, kABPersonAddressProperty, address, &error);
[addressDict release];
CFRelease(address);
ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init];
picker.displayedPerson = person;
picker.newPersonViewDelegate = self;
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:picker];
[self presentModalViewController:navigation animated:YES];
[picker release];
[navigation release];