crashing on iPhone Address API
- by phil swenson
Any ideas on why this code would crash (crash location indicated below)?
email is a valid NSString*... ([email protected])
+(void)newContactFromEmail:(DetailViewController*)controller email:(NSString*)emailAddress{
ABNewPersonViewController *npvc = [[ABNewPersonViewController alloc] init];
ABRecordRef newPerson = ABPersonCreate();
[self updateEmail:newPerson email:emailAddress];
npvc.displayedPerson = newPerson;
npvc.newPersonViewDelegate = controller;
[controller.navigationController pushViewController:npvc animated:YES];
}
+(void)updateEmail:(ABRecordRef)person email:(NSString*)email{
**crashes Here**---->> ABMutableMultiValueRef multiEmail = ABMultiValueCreateMutableCopy (ABRecordCopyValue(person, kABPersonEmailProperty));
ABMultiValueAddValueAndLabel(multiEmail, email, kABHomeLabel, NULL);
ABRecordSetValue(person, kABPersonEmailProperty, multiEmail, nil);
CFRelease(multiEmail);
}